Giter Club home page Giter Club logo

Comments (2)

leobragaz avatar leobragaz commented on May 23, 2024

Ok it is an issue that occurred after the first ever message’s edit.
In particular the editing of message with ID == 16, made in tx with txHash = 0900361423873B5B335887099C334AD005A4BEDF3B6FD61F1FC4B775D4DDC46A.
What’s happening here is the following situation:

  1. A user edits his/her own post, when this post it’s going to be saved, the LastPostID is set to the current edited post’s one, in our case: 16.
  2. After that, everyone who tries to create a new post will get the error Post with id 17 already exists because of the assignment.
    So this is a problem about how we currently handle posts ID and in particular with the way we set the ID to latest post inside handleMsgCreatePost .

from desmos.

leobragaz avatar leobragaz commented on May 23, 2024

Since I can't push my solution, I'll wrote it down here:
Adding a check (line 56) to make sure that the current post we are saving is a new one and not an edited one.

// Set the last post id
if post.LastEdited == sdk.ZeroInt() {
    store.Set([]byte(types.LastPostIDStoreKey), k.Cdc.MustMarshalBinaryBare(&post.PostID))
}

I think this will be enough, hope it's correct!

from desmos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.