chainntnfs/btcd+bitcoind tests: use common TxConfStatus
This commit is contained in:
parent
79b2ee7da5
commit
31dc387e0f
@ -111,8 +111,8 @@ func TestHistoricalConfDetailsTxIndex(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch txStatus {
|
switch txStatus {
|
||||||
case txNotFoundIndex:
|
case chainntnfs.TxNotFoundIndex:
|
||||||
case txNotFoundManually:
|
case chainntnfs.TxNotFoundManually:
|
||||||
t.Fatal("should not have proceeded with fallback method, but did")
|
t.Fatal("should not have proceeded with fallback method, but did")
|
||||||
default:
|
default:
|
||||||
t.Fatal("should not have found non-existent transaction, but did")
|
t.Fatal("should not have found non-existent transaction, but did")
|
||||||
@ -137,7 +137,7 @@ func TestHistoricalConfDetailsTxIndex(t *testing.T) {
|
|||||||
// Since it has yet to be included in a block, it should have been found
|
// Since it has yet to be included in a block, it should have been found
|
||||||
// within the mempool.
|
// within the mempool.
|
||||||
switch txStatus {
|
switch txStatus {
|
||||||
case txFoundMempool:
|
case chainntnfs.TxFoundMempool:
|
||||||
default:
|
default:
|
||||||
t.Fatal("should have found the transaction within the "+
|
t.Fatal("should have found the transaction within the "+
|
||||||
"mempool, but did not: %v", txStatus)
|
"mempool, but did not: %v", txStatus)
|
||||||
@ -159,7 +159,7 @@ func TestHistoricalConfDetailsTxIndex(t *testing.T) {
|
|||||||
// Since the backend node's txindex is enabled and the transaction has
|
// Since the backend node's txindex is enabled and the transaction has
|
||||||
// confirmed, we should be able to retrieve it using the txindex.
|
// confirmed, we should be able to retrieve it using the txindex.
|
||||||
switch txStatus {
|
switch txStatus {
|
||||||
case txFoundIndex:
|
case chainntnfs.TxFoundIndex:
|
||||||
default:
|
default:
|
||||||
t.Fatal("should have found the transaction within the " +
|
t.Fatal("should have found the transaction within the " +
|
||||||
"txindex, but did not")
|
"txindex, but did not")
|
||||||
@ -196,8 +196,8 @@ func TestHistoricalConfDetailsNoTxIndex(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch txStatus {
|
switch txStatus {
|
||||||
case txNotFoundManually:
|
case chainntnfs.TxNotFoundManually:
|
||||||
case txNotFoundIndex:
|
case chainntnfs.TxNotFoundIndex:
|
||||||
t.Fatal("should have proceeded with fallback method, but did not")
|
t.Fatal("should have proceeded with fallback method, but did not")
|
||||||
default:
|
default:
|
||||||
t.Fatal("should not have found non-existent transaction, but did")
|
t.Fatal("should not have found non-existent transaction, but did")
|
||||||
@ -237,7 +237,7 @@ func TestHistoricalConfDetailsNoTxIndex(t *testing.T) {
|
|||||||
// confirmed, we should be able to find it by falling back to scanning
|
// confirmed, we should be able to find it by falling back to scanning
|
||||||
// the chain manually.
|
// the chain manually.
|
||||||
switch txStatus {
|
switch txStatus {
|
||||||
case txFoundManually:
|
case chainntnfs.TxFoundManually:
|
||||||
default:
|
default:
|
||||||
t.Fatal("should have found the transaction by manually " +
|
t.Fatal("should have found the transaction by manually " +
|
||||||
"scanning the chain, but did not")
|
"scanning the chain, but did not")
|
||||||
|
@ -71,8 +71,8 @@ func TestHistoricalConfDetailsTxIndex(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch txStatus {
|
switch txStatus {
|
||||||
case txNotFoundIndex:
|
case chainntnfs.TxNotFoundIndex:
|
||||||
case txNotFoundManually:
|
case chainntnfs.TxNotFoundManually:
|
||||||
t.Fatal("should not have proceeded with fallback method, but did")
|
t.Fatal("should not have proceeded with fallback method, but did")
|
||||||
default:
|
default:
|
||||||
t.Fatal("should not have found non-existent transaction, but did")
|
t.Fatal("should not have found non-existent transaction, but did")
|
||||||
@ -88,6 +88,7 @@ func TestHistoricalConfDetailsTxIndex(t *testing.T) {
|
|||||||
t.Fatalf("unable to find tx in the mempool: %v", err)
|
t.Fatalf("unable to find tx in the mempool: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The transaction should be found in the mempool at this point.
|
||||||
_, txStatus, err = notifier.historicalConfDetails(txid, 0, 0)
|
_, txStatus, err = notifier.historicalConfDetails(txid, 0, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to retrieve historical conf details: %v", err)
|
t.Fatalf("unable to retrieve historical conf details: %v", err)
|
||||||
@ -96,10 +97,10 @@ func TestHistoricalConfDetailsTxIndex(t *testing.T) {
|
|||||||
// Since it has yet to be included in a block, it should have been found
|
// Since it has yet to be included in a block, it should have been found
|
||||||
// within the mempool.
|
// within the mempool.
|
||||||
switch txStatus {
|
switch txStatus {
|
||||||
case txFoundMempool:
|
case chainntnfs.TxFoundMempool:
|
||||||
default:
|
default:
|
||||||
t.Fatal("should have found the transaction within the " +
|
t.Fatalf("should have found the transaction within the "+
|
||||||
"mempool, but did not")
|
"mempool, but did not: %v", txStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
// We'll now confirm this transaction and re-attempt to retrieve its
|
// We'll now confirm this transaction and re-attempt to retrieve its
|
||||||
@ -116,7 +117,7 @@ func TestHistoricalConfDetailsTxIndex(t *testing.T) {
|
|||||||
// Since the backend node's txindex is enabled and the transaction has
|
// Since the backend node's txindex is enabled and the transaction has
|
||||||
// confirmed, we should be able to retrieve it using the txindex.
|
// confirmed, we should be able to retrieve it using the txindex.
|
||||||
switch txStatus {
|
switch txStatus {
|
||||||
case txFoundIndex:
|
case chainntnfs.TxFoundIndex:
|
||||||
default:
|
default:
|
||||||
t.Fatal("should have found the transaction within the " +
|
t.Fatal("should have found the transaction within the " +
|
||||||
"txindex, but did not")
|
"txindex, but did not")
|
||||||
@ -145,8 +146,8 @@ func TestHistoricalConfDetailsNoTxIndex(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch txStatus {
|
switch txStatus {
|
||||||
case txNotFoundManually:
|
case chainntnfs.TxNotFoundManually:
|
||||||
case txNotFoundIndex:
|
case chainntnfs.TxNotFoundIndex:
|
||||||
t.Fatal("should have proceeded with fallback method, but did not")
|
t.Fatal("should have proceeded with fallback method, but did not")
|
||||||
default:
|
default:
|
||||||
t.Fatal("should not have found non-existent transaction, but did")
|
t.Fatal("should not have found non-existent transaction, but did")
|
||||||
@ -175,7 +176,7 @@ func TestHistoricalConfDetailsNoTxIndex(t *testing.T) {
|
|||||||
|
|
||||||
// Since it has yet to be included in a block, it should have been found
|
// Since it has yet to be included in a block, it should have been found
|
||||||
// within the mempool.
|
// within the mempool.
|
||||||
if txStatus != txFoundMempool {
|
if txStatus != chainntnfs.TxFoundMempool {
|
||||||
t.Fatal("should have found the transaction within the " +
|
t.Fatal("should have found the transaction within the " +
|
||||||
"mempool, but did not")
|
"mempool, but did not")
|
||||||
}
|
}
|
||||||
@ -196,7 +197,7 @@ func TestHistoricalConfDetailsNoTxIndex(t *testing.T) {
|
|||||||
// Since the backend node's txindex is disabled and the transaction has
|
// Since the backend node's txindex is disabled and the transaction has
|
||||||
// confirmed, we should be able to find it by falling back to scanning
|
// confirmed, we should be able to find it by falling back to scanning
|
||||||
// the chain manually.
|
// the chain manually.
|
||||||
if txStatus != txFoundManually {
|
if txStatus != chainntnfs.TxFoundManually {
|
||||||
t.Fatal("should have found the transaction by manually " +
|
t.Fatal("should have found the transaction by manually " +
|
||||||
"scanning the chain, but did not")
|
"scanning the chain, but did not")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user