mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-12 04:41:22 +00:00
int/nonce fixes
This commit is contained in:
@ -25,23 +25,15 @@ func (tx *SendTx) AddInput(st AccountGetter, pubkey account.PubKey, amt uint64)
|
||||
if acc == nil {
|
||||
return fmt.Errorf("Invalid address %X from pubkey %X", addr, pubkey)
|
||||
}
|
||||
|
||||
tx.Inputs = append(tx.Inputs, &TxInput{
|
||||
Address: addr,
|
||||
Amount: amt,
|
||||
Sequence: uint(acc.Sequence) + 1,
|
||||
Signature: account.SignatureEd25519{},
|
||||
PubKey: pubkey,
|
||||
})
|
||||
return nil
|
||||
return tx.AddInputWithNonce(pubkey, amt, acc.Sequence+1)
|
||||
}
|
||||
|
||||
func (tx *SendTx) AddInputWithNonce(pubkey account.PubKey, amt, nonce uint64) error {
|
||||
func (tx *SendTx) AddInputWithNonce(pubkey account.PubKey, amt uint64, nonce uint) error {
|
||||
addr := pubkey.Address()
|
||||
tx.Inputs = append(tx.Inputs, &TxInput{
|
||||
Address: addr,
|
||||
Amount: amt,
|
||||
Sequence: uint(nonce) + 1,
|
||||
Sequence: nonce,
|
||||
Signature: account.SignatureEd25519{},
|
||||
PubKey: pubkey,
|
||||
})
|
||||
@ -75,16 +67,16 @@ func NewCallTx(st AccountGetter, from account.PubKey, to, data []byte, amt, gasL
|
||||
return nil, fmt.Errorf("Invalid address %X from pubkey %X", addr, from)
|
||||
}
|
||||
|
||||
nonce := uint64(acc.Sequence)
|
||||
nonce := acc.Sequence + 1
|
||||
return NewCallTxWithNonce(from, to, data, amt, gasLimit, fee, nonce), nil
|
||||
}
|
||||
|
||||
func NewCallTxWithNonce(from account.PubKey, to, data []byte, amt, gasLimit, fee, nonce uint64) *CallTx {
|
||||
func NewCallTxWithNonce(from account.PubKey, to, data []byte, amt, gasLimit, fee uint64, nonce uint) *CallTx {
|
||||
addr := from.Address()
|
||||
input := &TxInput{
|
||||
Address: addr,
|
||||
Amount: amt,
|
||||
Sequence: uint(nonce) + 1,
|
||||
Sequence: nonce,
|
||||
Signature: account.SignatureEd25519{},
|
||||
PubKey: from,
|
||||
}
|
||||
@ -113,16 +105,16 @@ func NewNameTx(st AccountGetter, from account.PubKey, name, data string, amt, fe
|
||||
return nil, fmt.Errorf("Invalid address %X from pubkey %X", addr, from)
|
||||
}
|
||||
|
||||
nonce := uint64(acc.Sequence)
|
||||
nonce := acc.Sequence + 1
|
||||
return NewNameTxWithNonce(from, name, data, amt, fee, nonce), nil
|
||||
}
|
||||
|
||||
func NewNameTxWithNonce(from account.PubKey, name, data string, amt, fee, nonce uint64) *NameTx {
|
||||
func NewNameTxWithNonce(from account.PubKey, name, data string, amt, fee uint64, nonce uint) *NameTx {
|
||||
addr := from.Address()
|
||||
input := &TxInput{
|
||||
Address: addr,
|
||||
Amount: amt,
|
||||
Sequence: uint(nonce) + 1,
|
||||
Sequence: nonce,
|
||||
Signature: account.SignatureEd25519{},
|
||||
PubKey: from,
|
||||
}
|
||||
@ -161,23 +153,15 @@ func (tx *BondTx) AddInput(st AccountGetter, pubkey account.PubKey, amt uint64)
|
||||
if acc == nil {
|
||||
return fmt.Errorf("Invalid address %X from pubkey %X", addr, pubkey)
|
||||
}
|
||||
|
||||
tx.Inputs = append(tx.Inputs, &TxInput{
|
||||
Address: addr,
|
||||
Amount: amt,
|
||||
Sequence: uint(acc.Sequence) + 1,
|
||||
Signature: account.SignatureEd25519{},
|
||||
PubKey: pubkey,
|
||||
})
|
||||
return nil
|
||||
return tx.AddInputWithNonce(pubkey, amt, acc.Sequence+1)
|
||||
}
|
||||
|
||||
func (tx *BondTx) AddInputWithNonce(pubkey account.PubKey, amt, nonce uint64) error {
|
||||
func (tx *BondTx) AddInputWithNonce(pubkey account.PubKey, amt uint64, nonce uint) error {
|
||||
addr := pubkey.Address()
|
||||
tx.Inputs = append(tx.Inputs, &TxInput{
|
||||
Address: addr,
|
||||
Amount: amt,
|
||||
Sequence: uint(nonce) + 1,
|
||||
Sequence: nonce,
|
||||
Signature: account.SignatureEd25519{},
|
||||
PubKey: pubkey,
|
||||
})
|
||||
|
Reference in New Issue
Block a user