@@ -271,12 +271,20 @@ func TestTxNotifierFutureConfDispatch(t *testing.T) {
271271 // We should only receive one update for tx1 since it only requires
272272 // one confirmation and it already met it.
273273 select {
274- case numConfsLeft := <- ntfn1 .Event .Updates :
275- const expected = 0
276- if numConfsLeft != expected {
274+ case updDetails := <- ntfn1 .Event .Updates :
275+ expected := chainntnfs.TxUpdateInfo {
276+ NumConfsLeft : 0 ,
277+ BlockHeight : 11 ,
278+ }
279+ if updDetails .NumConfsLeft != expected .NumConfsLeft {
277280 t .Fatalf ("Received incorrect confirmation update: tx1 " +
278281 "expected %d confirmations left, got %d" ,
279- expected , numConfsLeft )
282+ expected .NumConfsLeft , updDetails .NumConfsLeft )
283+ }
284+ if updDetails .BlockHeight != expected .BlockHeight {
285+ t .Fatalf ("Received incorrect confirmation update: tx1 " +
286+ "expected %d block height, got %d" ,
287+ expected .BlockHeight , updDetails .BlockHeight )
280288 }
281289 default :
282290 t .Fatal ("Expected confirmation update for tx1" )
@@ -300,12 +308,20 @@ func TestTxNotifierFutureConfDispatch(t *testing.T) {
300308 // We should only receive one update for tx2 since it only has one
301309 // confirmation so far and it requires two.
302310 select {
303- case numConfsLeft := <- ntfn2 .Event .Updates :
304- const expected = 1
305- if numConfsLeft != expected {
311+ case updDetails := <- ntfn2 .Event .Updates :
312+ expected := chainntnfs.TxUpdateInfo {
313+ NumConfsLeft : 1 ,
314+ BlockHeight : 11 ,
315+ }
316+ if updDetails .NumConfsLeft != expected .NumConfsLeft {
306317 t .Fatalf ("Received incorrect confirmation update: tx2 " +
307318 "expected %d confirmations left, got %d" ,
308- expected , numConfsLeft )
319+ expected .NumConfsLeft , updDetails .NumConfsLeft )
320+ }
321+ if updDetails .BlockHeight != expected .BlockHeight {
322+ t .Fatalf ("Received incorrect confirmation update: tx2 " +
323+ "expected %d block height, got %d" ,
324+ expected .BlockHeight , updDetails .BlockHeight )
309325 }
310326 default :
311327 t .Fatal ("Expected confirmation update for tx2" )
@@ -341,12 +357,20 @@ func TestTxNotifierFutureConfDispatch(t *testing.T) {
341357 // We should only receive one update since the last at the new height,
342358 // indicating how many confirmations are still left.
343359 select {
344- case numConfsLeft := <- ntfn2 .Event .Updates :
345- const expected = 0
346- if numConfsLeft != expected {
360+ case updDetails := <- ntfn2 .Event .Updates :
361+ expected := chainntnfs.TxUpdateInfo {
362+ NumConfsLeft : 0 ,
363+ BlockHeight : 11 ,
364+ }
365+ if updDetails .NumConfsLeft != expected .NumConfsLeft {
347366 t .Fatalf ("Received incorrect confirmation update: tx2 " +
348367 "expected %d confirmations left, got %d" ,
349- expected , numConfsLeft )
368+ expected .NumConfsLeft , updDetails .NumConfsLeft )
369+ }
370+ if updDetails .BlockHeight != expected .BlockHeight {
371+ t .Fatalf ("Received incorrect confirmation update: tx2 " +
372+ "expected %d block height, got %d" ,
373+ expected .BlockHeight , updDetails .BlockHeight )
350374 }
351375 default :
352376 t .Fatal ("Expected confirmation update for tx2" )
@@ -411,12 +435,20 @@ func TestTxNotifierHistoricalConfDispatch(t *testing.T) {
411435 err = n .UpdateConfDetails (ntfn1 .HistoricalDispatch .ConfRequest , & txConf1 )
412436 require .NoError (t , err , "unable to update conf details" )
413437 select {
414- case numConfsLeft := <- ntfn1 .Event .Updates :
415- const expected = 0
416- if numConfsLeft != expected {
438+ case updDetails := <- ntfn1 .Event .Updates :
439+ expected := chainntnfs.TxUpdateInfo {
440+ NumConfsLeft : 0 ,
441+ BlockHeight : 9 ,
442+ }
443+ if updDetails .NumConfsLeft != expected .NumConfsLeft {
417444 t .Fatalf ("Received incorrect confirmation update: tx1 " +
418445 "expected %d confirmations left, got %d" ,
419- expected , numConfsLeft )
446+ expected .NumConfsLeft , updDetails .NumConfsLeft )
447+ }
448+ if updDetails .BlockHeight != expected .BlockHeight {
449+ t .Fatalf ("Received incorrect confirmation update: tx1 " +
450+ "expected %d block height, got %d" ,
451+ expected .BlockHeight , updDetails .BlockHeight )
420452 }
421453 default :
422454 t .Fatal ("Expected confirmation update for tx1" )
@@ -443,12 +475,20 @@ func TestTxNotifierHistoricalConfDispatch(t *testing.T) {
443475 err = n .UpdateConfDetails (ntfn2 .HistoricalDispatch .ConfRequest , & txConf2 )
444476 require .NoError (t , err , "unable to update conf details" )
445477 select {
446- case numConfsLeft := <- ntfn2 .Event .Updates :
447- const expected = 1
448- if numConfsLeft != expected {
478+ case updDetails := <- ntfn2 .Event .Updates :
479+ expected := chainntnfs.TxUpdateInfo {
480+ NumConfsLeft : 1 ,
481+ BlockHeight : 9 ,
482+ }
483+ if updDetails .NumConfsLeft != expected .NumConfsLeft {
449484 t .Fatalf ("Received incorrect confirmation update: tx2 " +
450485 "expected %d confirmations left, got %d" ,
451- expected , numConfsLeft )
486+ expected .NumConfsLeft , updDetails .NumConfsLeft )
487+ }
488+ if updDetails .BlockHeight != expected .BlockHeight {
489+ t .Fatalf ("Received incorrect confirmation update: tx2 " +
490+ "expected %d block height, got %d" ,
491+ expected .BlockHeight , updDetails .BlockHeight )
452492 }
453493 default :
454494 t .Fatal ("Expected confirmation update for tx2" )
@@ -485,12 +525,20 @@ func TestTxNotifierHistoricalConfDispatch(t *testing.T) {
485525 // We should only receive one update for tx2 since the last one,
486526 // indicating how many confirmations are still left.
487527 select {
488- case numConfsLeft := <- ntfn2 .Event .Updates :
489- const expected = 0
490- if numConfsLeft != expected {
528+ case updDetails := <- ntfn2 .Event .Updates :
529+ expected := chainntnfs.TxUpdateInfo {
530+ NumConfsLeft : 0 ,
531+ BlockHeight : 9 ,
532+ }
533+ if updDetails .NumConfsLeft != expected .NumConfsLeft {
491534 t .Fatalf ("Received incorrect confirmation update: tx2 " +
492535 "expected %d confirmations left, got %d" ,
493- expected , numConfsLeft )
536+ expected .NumConfsLeft , updDetails .NumConfsLeft )
537+ }
538+ if updDetails .BlockHeight != expected .BlockHeight {
539+ t .Fatalf ("Received incorrect confirmation update: tx2 " +
540+ "expected %d block height, got %d" ,
541+ expected .BlockHeight , updDetails .BlockHeight )
494542 }
495543 default :
496544 t .Fatal ("Expected confirmation update for tx2" )
@@ -1490,12 +1538,20 @@ func TestTxNotifierConfReorg(t *testing.T) {
14901538 // We should only receive one update for tx2 since it only requires
14911539 // one confirmation and it already met it.
14921540 select {
1493- case numConfsLeft := <- ntfn2 .Event .Updates :
1494- const expected = 0
1495- if numConfsLeft != expected {
1541+ case updDetails := <- ntfn2 .Event .Updates :
1542+ expected := chainntnfs.TxUpdateInfo {
1543+ NumConfsLeft : 0 ,
1544+ BlockHeight : 12 ,
1545+ }
1546+ if updDetails .NumConfsLeft != expected .NumConfsLeft {
14961547 t .Fatalf ("Received incorrect confirmation update: tx2 " +
14971548 "expected %d confirmations left, got %d" ,
1498- expected , numConfsLeft )
1549+ expected .NumConfsLeft , updDetails .NumConfsLeft )
1550+ }
1551+ if updDetails .BlockHeight != expected .BlockHeight {
1552+ t .Fatalf ("Received incorrect confirmation update: tx2 " +
1553+ "expected %d block height, got %d" ,
1554+ expected .BlockHeight , updDetails .BlockHeight )
14991555 }
15001556 default :
15011557 t .Fatal ("Expected confirmation update for tx2" )
@@ -1520,12 +1576,23 @@ func TestTxNotifierConfReorg(t *testing.T) {
15201576 // confirmations and it has already met them.
15211577 for i := uint32 (1 ); i <= 2 ; i ++ {
15221578 select {
1523- case numConfsLeft := <- ntfn3 .Event .Updates :
1524- expected := tx3NumConfs - i
1525- if numConfsLeft != expected {
1526- t .Fatalf ("Received incorrect confirmation update: tx3 " +
1527- "expected %d confirmations left, got %d" ,
1528- expected , numConfsLeft )
1579+ case updDetails := <- ntfn3 .Event .Updates :
1580+ expected := chainntnfs.TxUpdateInfo {
1581+ NumConfsLeft : tx3NumConfs - i ,
1582+ BlockHeight : 12 ,
1583+ }
1584+ if updDetails .NumConfsLeft != expected .NumConfsLeft {
1585+ t .Fatalf ("Received incorrect confirmation " +
1586+ "update: tx3 expected %d " +
1587+ "confirmations left, got %d" ,
1588+ expected .NumConfsLeft ,
1589+ updDetails .NumConfsLeft )
1590+ }
1591+ if updDetails .BlockHeight != expected .BlockHeight {
1592+ t .Fatalf ("Received incorrect confirmation " +
1593+ "update: tx3 expected %d block " +
1594+ "height, got %d" , expected .BlockHeight ,
1595+ updDetails .BlockHeight )
15291596 }
15301597 default :
15311598 t .Fatal ("Expected confirmation update for tx2" )
0 commit comments