chainntnfs: include transaction in confirmation details

This commit is contained in:
Wilmer Paulino
2018-12-10 18:24:04 -08:00
parent 5ab30cf7ea
commit 50650d054e
6 changed files with 83 additions and 31 deletions

View File

@@ -256,6 +256,7 @@ func TestTxNotifierFutureConfDispatch(t *testing.T) {
BlockHash: block1.Hash(),
BlockHeight: 11,
TxIndex: 0,
Tx: &tx1,
}
assertConfDetails(t, txConf, &expectedConf)
default:
@@ -327,6 +328,7 @@ func TestTxNotifierFutureConfDispatch(t *testing.T) {
BlockHash: block1.Hash(),
BlockHeight: 11,
TxIndex: 1,
Tx: &tx2,
}
assertConfDetails(t, txConf, &expectedConf)
default:
@@ -386,6 +388,7 @@ func TestTxNotifierHistoricalConfDispatch(t *testing.T) {
BlockHash: &chainntnfs.ZeroHash,
BlockHeight: 9,
TxIndex: 1,
Tx: &tx1,
}
err := n.UpdateConfDetails(ntfn1.ConfRequest, &txConf1)
if err != nil {
@@ -419,6 +422,7 @@ func TestTxNotifierHistoricalConfDispatch(t *testing.T) {
BlockHash: &chainntnfs.ZeroHash,
BlockHeight: 9,
TxIndex: 2,
Tx: &tx2,
}
err = n.UpdateConfDetails(ntfn2.ConfRequest, &txConf2)
if err != nil {
@@ -1344,6 +1348,7 @@ func TestTxNotifierConfReorg(t *testing.T) {
BlockHash: block3.Hash(),
BlockHeight: 12,
TxIndex: 0,
Tx: &tx2,
}
assertConfDetails(t, txConf, &expectedConf)
default:
@@ -1374,6 +1379,7 @@ func TestTxNotifierConfReorg(t *testing.T) {
BlockHash: block3.Hash(),
BlockHeight: 12,
TxIndex: 1,
Tx: &tx3,
}
assertConfDetails(t, txConf, &expectedConf)
default:
@@ -2106,6 +2112,10 @@ func assertConfDetails(t *testing.T, result, expected *chainntnfs.TxConfirmation
t.Fatalf("Incorrect tx index in confirmation details: "+
"expected %d, got %d", expected.TxIndex, result.TxIndex)
}
if result.Tx.TxHash() != expected.Tx.TxHash() {
t.Fatalf("expected tx hash %v, got %v", expected.Tx.TxHash(),
result.Tx.TxHash())
}
}
func assertSpendDetails(t *testing.T, result, expected *chainntnfs.SpendDetail) {