From c3431f4fffbe03733091eb8fa3cb882971e79f6b Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 7 Jul 2020 10:24:58 +0300 Subject: [PATCH] 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. --- cli/wallet/nep5.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cli/wallet/nep5.go b/cli/wallet/nep5.go index 129fe5aa8..58c2cfb22 100644 --- a/cli/wallet/nep5.go +++ b/cli/wallet/nep5.go @@ -17,6 +17,9 @@ import ( "github.com/urfave/cli" ) +// validUntilBlockIncrement is the number of extra blocks to add to an exported transaction +const validUntilBlockIncrement = 50 + var ( neoToken = wallet.NewToken(client.NeoContractHash, "NEO", "neo", 0) gasToken = wallet.NewToken(client.GasContractHash, "GAS", "gas", 8) @@ -366,6 +369,8 @@ func transferNEP5(ctx *cli.Context) error { } if outFile := ctx.String("out"); outFile != "" { + // avoid fast transaction expiration + tx.ValidUntilBlock += validUntilBlockIncrement priv := acc.PrivateKey() pub := priv.PublicKey() sign := priv.Sign(tx.GetSignedPart())