Add test for unmined transaction DestAddresses
Co-authored-by: Christopher Coverdale <chris.coverdale24@gmail.com>
This commit is contained in:
1 parent
f33df0928d
commit
fe2a565bec
1 file changed
+19
-3
@@ -1181,9 +1181,11 @@ func testListTransactionDetails(miner *rpctest.Harness,
|
|||||||
|
|
||||||
// Next create a transaction paying to an output which isn't under the
|
// Next create a transaction paying to an output which isn't under the
|
||||||
// wallet's control.
|
// wallet's control.
|
||||||
b := txscript.NewScriptBuilder()
|
minerAddr, err := miner.NewAddress()
|
||||||
b.AddOp(txscript.OP_0)
|
if err != nil {
|
||||||
outputScript, err := b.Script()
|
t.Fatalf("unable to generate address: %v", err)
|
||||||
|
}
|
||||||
|
outputScript, err := txscript.PayToAddrScript(minerAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to make output script: %v", err)
|
t.Fatalf("unable to make output script: %v", err)
|
||||||
}
|
}
|
||||||
@@ -1227,6 +1229,20 @@ func testListTransactionDetails(miner *rpctest.Harness,
|
|||||||
t.Fatalf("num confs incorrect, got %v expected %v",
|
t.Fatalf("num confs incorrect, got %v expected %v",
|
||||||
txDetail.NumConfirmations, 0)
|
txDetail.NumConfirmations, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We test that each txDetail has destination addresses. This ensures
|
||||||
|
// that even when we have 0 confirmation transactions, the destination
|
||||||
|
// addresses are returned.
|
||||||
|
var match bool
|
||||||
|
for _, addr := range txDetail.DestAddresses {
|
||||||
|
if addr.String() == minerAddr.String() {
|
||||||
|
match = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !match {
|
||||||
|
t.Fatalf("minerAddr: %v should have been a dest addr", minerAddr)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if !mempoolTxFound {
|
if !mempoolTxFound {
|
||||||
t.Fatalf("unable to find mempool tx in tx details!")
|
t.Fatalf("unable to find mempool tx in tx details!")
|
||||||
|
|||||||
Reference in new issue
Block a user