cli: add extra validUntilBlockIncrement to transferNEP5

When we export tx to a file, we might need validUntilBlock to be larger
a bit in order to use it in future.
This commit is contained in:
Anna Shaleva 2020-07-07 10:24:58 +03:00
parent 7d8a3a7065
commit c3431f4fff

View file

@ -17,6 +17,9 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
) )
// validUntilBlockIncrement is the number of extra blocks to add to an exported transaction
const validUntilBlockIncrement = 50
var ( var (
neoToken = wallet.NewToken(client.NeoContractHash, "NEO", "neo", 0) neoToken = wallet.NewToken(client.NeoContractHash, "NEO", "neo", 0)
gasToken = wallet.NewToken(client.GasContractHash, "GAS", "gas", 8) gasToken = wallet.NewToken(client.GasContractHash, "GAS", "gas", 8)
@ -366,6 +369,8 @@ func transferNEP5(ctx *cli.Context) error {
} }
if outFile := ctx.String("out"); outFile != "" { if outFile := ctx.String("out"); outFile != "" {
// avoid fast transaction expiration
tx.ValidUntilBlock += validUntilBlockIncrement
priv := acc.PrivateKey() priv := acc.PrivateKey()
pub := priv.PublicKey() pub := priv.PublicKey()
sign := priv.Sign(tx.GetSignedPart()) sign := priv.Sign(tx.GetSignedPart())