|
|
|
@ -63,8 +63,8 @@ public class NewPendingTransactionAcceptanceTest extends AcceptanceTestBase { |
|
|
|
|
// Create the light fork
|
|
|
|
|
final Subscription lightForkSubscription = minerWebSocket.subscribe(); |
|
|
|
|
|
|
|
|
|
final Hash lightForkEvent = accounts.transfer(accountOne, 5, minerNode); |
|
|
|
|
cluster.awaitPropagation(accountOne, 5); |
|
|
|
|
final Hash lightForkEvent = minerNode.execute(transactions.createTransfer(accountOne, 5)); |
|
|
|
|
cluster.verify(accountOne.balanceEquals(5)); |
|
|
|
|
|
|
|
|
|
minerWebSocket.verifyTotalEventsReceived(1); |
|
|
|
|
lightForkSubscription.verifyEventReceived(lightForkEvent); |
|
|
|
@ -86,14 +86,14 @@ public class NewPendingTransactionAcceptanceTest extends AcceptanceTestBase { |
|
|
|
|
final Account heavyForkBenefactor = accounts.getSecondaryBenefactor(); |
|
|
|
|
|
|
|
|
|
final Hash heavyForkEventOne = |
|
|
|
|
accounts.transfer(heavyForkBenefactor, accountTwo, 1, minerNodeTwo); |
|
|
|
|
cluster.awaitPropagation(accountTwo, 1); |
|
|
|
|
minerNodeTwo.execute(transactions.createTransfer(heavyForkBenefactor, accountTwo, 1)); |
|
|
|
|
cluster.verify(accountTwo.balanceEquals(1)); |
|
|
|
|
final Hash heavyForkEventTwo = |
|
|
|
|
accounts.transfer(heavyForkBenefactor, accountTwo, 2, minerNodeTwo); |
|
|
|
|
cluster.awaitPropagation(accountTwo, 1 + 2); |
|
|
|
|
minerNodeTwo.execute(transactions.createTransfer(heavyForkBenefactor, accountTwo, 2)); |
|
|
|
|
cluster.verify(accountTwo.balanceEquals(1 + 2)); |
|
|
|
|
final Hash heavyForkEventThree = |
|
|
|
|
accounts.transfer(heavyForkBenefactor, accountTwo, 3, minerNodeTwo); |
|
|
|
|
cluster.awaitPropagation(accountTwo, 1 + 2 + 3); |
|
|
|
|
minerNodeTwo.execute(transactions.createTransfer(heavyForkBenefactor, accountTwo, 3)); |
|
|
|
|
cluster.verify(accountTwo.balanceEquals(1 + 2 + 3)); |
|
|
|
|
|
|
|
|
|
heavyForkWebSocket.verifyTotalEventsReceived(3); |
|
|
|
|
heavyForkSubscription.verifyEventReceived(heavyForkEventOne); |
|
|
|
@ -121,8 +121,9 @@ public class NewPendingTransactionAcceptanceTest extends AcceptanceTestBase { |
|
|
|
|
|
|
|
|
|
// This publish give time needed for heavy fork to be chosen
|
|
|
|
|
final Hash mergedForksEventOne = |
|
|
|
|
accounts.transfer(accounts.getSecondaryBenefactor(), accountTwo, 3, minerNodeTwo); |
|
|
|
|
cluster.awaitPropagation(accountTwo, 9); |
|
|
|
|
minerNodeTwo.execute( |
|
|
|
|
transactions.createTransfer(accounts.getSecondaryBenefactor(), accountTwo, 3)); |
|
|
|
|
cluster.verify(accountTwo.balanceEquals(9)); |
|
|
|
|
|
|
|
|
|
minerMergedForksWebSocket.verifyTotalEventsReceived(1); |
|
|
|
|
minerMergedForksSubscription.verifyEventReceived(lightForkEvent); |
|
|
|
@ -134,13 +135,14 @@ public class NewPendingTransactionAcceptanceTest extends AcceptanceTestBase { |
|
|
|
|
|
|
|
|
|
// Check that account two (funded in heavier chain) can be mined on miner one (from lighter
|
|
|
|
|
// chain)
|
|
|
|
|
final Hash mergedForksEventTwo = accounts.transfer(accountTwo, 3, minerNode); |
|
|
|
|
cluster.awaitPropagation(accountTwo, 9 + 3); |
|
|
|
|
final Hash mergedForksEventTwo = minerNode.execute(transactions.createTransfer(accountTwo, 3)); |
|
|
|
|
cluster.verify(accountTwo.balanceEquals(9 + 3)); |
|
|
|
|
|
|
|
|
|
// Check that account one (funded in lighter chain) can be mined on miner two (from heavier
|
|
|
|
|
// chain)
|
|
|
|
|
final Hash mergedForksEventThree = accounts.transfer(accountOne, 2, minerNodeTwo); |
|
|
|
|
cluster.awaitPropagation(accountOne, 5 + 2); |
|
|
|
|
final Hash mergedForksEventThree = |
|
|
|
|
minerNodeTwo.execute(transactions.createTransfer(accountOne, 2)); |
|
|
|
|
cluster.verify(accountOne.balanceEquals(5 + 2)); |
|
|
|
|
|
|
|
|
|
minerMergedForksWebSocket.verifyTotalEventsReceived(1 + 1 + 1); |
|
|
|
|
minerMergedForksSubscription.verifyEventReceived(mergedForksEventTwo); |
|
|
|
@ -157,8 +159,8 @@ public class NewPendingTransactionAcceptanceTest extends AcceptanceTestBase { |
|
|
|
|
public void subscriptionToMinerNodeMustReceivePublishEvent() { |
|
|
|
|
final Subscription minerSubscription = minerWebSocket.subscribe(); |
|
|
|
|
|
|
|
|
|
final Hash event = accounts.transfer(accountOne, 4, minerNode); |
|
|
|
|
cluster.awaitPropagation(accountOne, 4); |
|
|
|
|
final Hash event = minerNode.execute(transactions.createTransfer(accountOne, 4)); |
|
|
|
|
cluster.verify(accountOne.balanceEquals(4)); |
|
|
|
|
|
|
|
|
|
minerWebSocket.verifyTotalEventsReceived(1); |
|
|
|
|
minerSubscription.verifyEventReceived(event); |
|
|
|
@ -170,8 +172,8 @@ public class NewPendingTransactionAcceptanceTest extends AcceptanceTestBase { |
|
|
|
|
public void subscriptionToArchiveNodeMustReceivePublishEvent() { |
|
|
|
|
final Subscription archiveSubscription = archiveWebSocket.subscribe(); |
|
|
|
|
|
|
|
|
|
final Hash event = accounts.transfer(accountOne, 23, minerNode); |
|
|
|
|
cluster.awaitPropagation(accountOne, 23); |
|
|
|
|
final Hash event = minerNode.execute(transactions.createTransfer(accountOne, 23)); |
|
|
|
|
cluster.verify(accountOne.balanceEquals(23)); |
|
|
|
|
|
|
|
|
|
archiveWebSocket.verifyTotalEventsReceived(1); |
|
|
|
|
archiveSubscription.verifyEventReceived(event); |
|
|
|
@ -187,8 +189,8 @@ public class NewPendingTransactionAcceptanceTest extends AcceptanceTestBase { |
|
|
|
|
final Subscription archiveSubscriptionTwo = archiveWebSocket.subscribe(); |
|
|
|
|
final Subscription archiveSubscriptionThree = archiveWebSocket.subscribe(); |
|
|
|
|
|
|
|
|
|
final Hash event = accounts.transfer(accountOne, 30, minerNode); |
|
|
|
|
cluster.awaitPropagation(accountOne, 30); |
|
|
|
|
final Hash event = minerNode.execute(transactions.createTransfer(accountOne, 30)); |
|
|
|
|
cluster.verify(accountOne.balanceEquals(30)); |
|
|
|
|
|
|
|
|
|
minerWebSocket.verifyTotalEventsReceived(2); |
|
|
|
|
minerSubscriptionOne.verifyEventReceived(event); |
|
|
|
@ -210,15 +212,15 @@ public class NewPendingTransactionAcceptanceTest extends AcceptanceTestBase { |
|
|
|
|
public void subscriptionToMinerNodeMustReceiveEveryPublishEvent() { |
|
|
|
|
final Subscription minerSubscription = minerWebSocket.subscribe(); |
|
|
|
|
|
|
|
|
|
final Hash eventOne = accounts.transfer(accountOne, 1, minerNode); |
|
|
|
|
cluster.awaitPropagation(accountOne, 1); |
|
|
|
|
final Hash eventOne = minerNode.execute(transactions.createTransfer(accountOne, 1)); |
|
|
|
|
cluster.verify(accountOne.balanceEquals(1)); |
|
|
|
|
|
|
|
|
|
minerWebSocket.verifyTotalEventsReceived(1); |
|
|
|
|
minerSubscription.verifyEventReceived(eventOne); |
|
|
|
|
|
|
|
|
|
final Hash eventTwo = accounts.transfer(accountOne, 4, minerNode); |
|
|
|
|
final Hash eventThree = accounts.transfer(accountOne, 5, minerNode); |
|
|
|
|
cluster.awaitPropagation(accountOne, 1 + 4 + 5); |
|
|
|
|
final Hash eventTwo = minerNode.execute(transactions.createTransfer(accountOne, 4)); |
|
|
|
|
final Hash eventThree = minerNode.execute(transactions.createTransfer(accountOne, 5)); |
|
|
|
|
cluster.verify(accountOne.balanceEquals(1 + 4 + 5)); |
|
|
|
|
|
|
|
|
|
minerWebSocket.verifyTotalEventsReceived(3); |
|
|
|
|
minerSubscription.verifyEventReceived(eventTwo); |
|
|
|
@ -231,16 +233,16 @@ public class NewPendingTransactionAcceptanceTest extends AcceptanceTestBase { |
|
|
|
|
public void subscriptionToArchiveNodeMustReceiveEveryPublishEvent() { |
|
|
|
|
final Subscription archiveSubscription = archiveWebSocket.subscribe(); |
|
|
|
|
|
|
|
|
|
final Hash eventOne = accounts.transfer(accountOne, 2, minerNode); |
|
|
|
|
final Hash eventTwo = accounts.transfer(accountOne, 5, minerNode); |
|
|
|
|
cluster.awaitPropagation(accountOne, 2 + 5); |
|
|
|
|
final Hash eventOne = minerNode.execute(transactions.createTransfer(accountOne, 2)); |
|
|
|
|
final Hash eventTwo = minerNode.execute(transactions.createTransfer(accountOne, 5)); |
|
|
|
|
cluster.verify(accountOne.balanceEquals(2 + 5)); |
|
|
|
|
|
|
|
|
|
archiveWebSocket.verifyTotalEventsReceived(2); |
|
|
|
|
archiveSubscription.verifyEventReceived(eventOne); |
|
|
|
|
archiveSubscription.verifyEventReceived(eventTwo); |
|
|
|
|
|
|
|
|
|
final Hash eventThree = accounts.transfer(accountOne, 8, minerNode); |
|
|
|
|
cluster.awaitPropagation(accountOne, 2 + 5 + 8); |
|
|
|
|
final Hash eventThree = minerNode.execute(transactions.createTransfer(accountOne, 8)); |
|
|
|
|
cluster.verify(accountOne.balanceEquals(2 + 5 + 8)); |
|
|
|
|
|
|
|
|
|
archiveWebSocket.verifyTotalEventsReceived(3); |
|
|
|
|
archiveSubscription.verifyEventReceived(eventThree); |
|
|
|
@ -256,9 +258,9 @@ public class NewPendingTransactionAcceptanceTest extends AcceptanceTestBase { |
|
|
|
|
final Subscription archiveSubscriptionTwo = archiveWebSocket.subscribe(); |
|
|
|
|
final Subscription archiveSubscriptionThree = archiveWebSocket.subscribe(); |
|
|
|
|
|
|
|
|
|
final Hash eventOne = accounts.transfer(accountOne, 10, minerNode); |
|
|
|
|
final Hash eventTwo = accounts.transfer(accountOne, 5, minerNode); |
|
|
|
|
cluster.awaitPropagation(accountOne, 10 + 5); |
|
|
|
|
final Hash eventOne = minerNode.execute(transactions.createTransfer(accountOne, 10)); |
|
|
|
|
final Hash eventTwo = minerNode.execute(transactions.createTransfer(accountOne, 5)); |
|
|
|
|
cluster.verify(accountOne.balanceEquals(10 + 5)); |
|
|
|
|
|
|
|
|
|
minerWebSocket.verifyTotalEventsReceived(4); |
|
|
|
|
minerSubscriptionOne.verifyEventReceived(eventOne); |
|
|
|
|