vocdoni / vaas-api

Centralized backend & server for Vocdoni's Voting-as-a-Service API
GNU Affero General Public License v3.0
2 stars 1 forks source link

Change Vochain transaction nonce from random bytes to uint32 #47

Closed jordipainan closed 2 years ago

jordipainan commented 2 years ago

Like in this line: https://github.com/vocdoni/vaas-api/blob/master/vocclient/vocclient.go#L570 Setting an account infoURI requires the tx to provide a valid account nonce which is the autoincremental one not a random one like in the past. So the flow will be:

To take into account: Getting the nonce when a tx is pending to be mined will return the same nonce that is used in such tx. So as the mempool does not have ordering can be that a second tx sent with the same nonce is added into the storage before tx 1. This means that the first transaction will be invalidated.

jordipainan commented 2 years ago

cc: @emmdim

jordipainan commented 2 years ago

Done: 2758a373057c8733bea2ac56f9010703fac86fbb