forked from TrueCloudLab/neoneo-go
cli: fix canceltx ValidUntilBlock parameter of conflicting transaction
If main transaction is known, then conflicting transaction shouldn't be valid longer than the main one. Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
4c6dca876c
commit
4f5e3f363a
2 changed files with 13 additions and 10 deletions
|
@ -64,6 +64,9 @@ func cancelTx(ctx *cli.Context) error {
|
||||||
t.NetworkFee = mainTx.NetworkFee + 1
|
t.NetworkFee = mainTx.NetworkFee + 1
|
||||||
}
|
}
|
||||||
t.NetworkFee += int64(flags.Fixed8FromContext(ctx, "gas"))
|
t.NetworkFee += int64(flags.Fixed8FromContext(ctx, "gas"))
|
||||||
|
if mainTx != nil {
|
||||||
|
t.ValidUntilBlock = mainTx.ValidUntilBlock
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -56,16 +56,16 @@ func NewCommands() []cli.Command {
|
||||||
Usage: "Cancel transaction by sending conflicting transaction",
|
Usage: "Cancel transaction by sending conflicting transaction",
|
||||||
UsageText: "canceltx <txid> -r <endpoint> --wallet <wallet> [--account <account>] [--wallet-config <path>] [--gas <gas>]",
|
UsageText: "canceltx <txid> -r <endpoint> --wallet <wallet> [--account <account>] [--wallet-config <path>] [--gas <gas>]",
|
||||||
Description: `Aims to prevent a transaction from being added to the blockchain by dispatching a more
|
Description: `Aims to prevent a transaction from being added to the blockchain by dispatching a more
|
||||||
prioritized conflicting transaction to the specified RPC node. The input for this command should
|
prioritized conflicting transaction to the specified RPC node. The input for this command should
|
||||||
be the transaction hash. If another account is not specified, the conflicting transaction is
|
be the transaction hash. If another account is not specified, the conflicting transaction is
|
||||||
automatically generated and signed by the default account in the wallet. If the target transaction
|
automatically generated and signed by the default account in the wallet. If the target transaction
|
||||||
is in the memory pool of the provided RPC node, the NetworkFee value of the conflicting transaction
|
is in the memory pool of the provided RPC node, the NetworkFee value of the conflicting transaction
|
||||||
is set to the target transaction's NetworkFee value plus one (if it's sufficient for the
|
is set to the target transaction's NetworkFee value plus one (if it's sufficient for the
|
||||||
conflicting transaction itself). If the target transaction is not in the memory pool, standard
|
conflicting transaction itself), the ValidUntilBlock value of the conflicting transaction is set to the
|
||||||
NetworkFee calculations are performed based on the calculatenetworkfee RPC request. If the --gas
|
target transaction's ValidUntilBlock value. If the target transaction is not in the memory pool, standard
|
||||||
flag is included, the specified value is added to the resulting conflicting transaction network fee
|
NetworkFee calculations are performed based on the calculatenetworkfee RPC request. If the --gas
|
||||||
in both scenarios.
|
flag is included, the specified value is added to the resulting conflicting transaction network fee
|
||||||
`,
|
in both scenarios.`,
|
||||||
Action: cancelTx,
|
Action: cancelTx,
|
||||||
Flags: txCancelFlags,
|
Flags: txCancelFlags,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue