Commit ddbdb42
committed
fix(sdk-coin-tao): fix _outputs accumulation and case-insensitive verify
Two correctness bugs identified by post-commit review:
1. ClaimRootTransaction.loadInputsAndOutputs() used push() without
resetting _outputs/_ inputs first. The base TransactionBuilder calls
loadInputsAndOutputs() on every build(), so repeated build() calls
accumulated duplicate entries in _outputs. Fixed by resetting both
arrays at the top of the method before delegating to super and
before any push — consistent with how the base Transaction class
handles Send/Staking paths via assignment.
2. Tao.verifyTransaction() compared txParams.type with the string
literal 'StakingClaim' using strict equality. WalletPlatform delivers
intentType as lowercase ('stakingclaim'), causing the bypass to be
skipped and execution to fall through to super.verifyTransaction()
which accesses _to/_amount (absent on ClaimRootBuilder) and throws
'missing recipients in txParams' for a valid claim transaction.
Fixed with toLowerCase() comparison.
Also strengthen tests: add case-insensitive lowercase test for
verifyTransaction and assert explanation.fee.fee value (tip=0 fallback).
Ticket: SI-1171
Session-Id: ab70e181-1628-4e73-9662-8ef3fe0426ba
Task-Id: 091af7ce-ed42-4177-9ee0-2231917f41fa1 parent 8056f08 commit ddbdb42
4 files changed
Lines changed: 15 additions & 1 deletion
File tree
- modules/sdk-coin-tao
- src
- lib
- test/unit
- transactionBuilder
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
573 | 573 | | |
574 | 574 | | |
575 | 575 | | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
576 | 584 | | |
577 | 585 | | |
578 | 586 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
| |||
0 commit comments