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