Skip to content

Commit

Permalink
updates to demo_setup.py to setup nodes for demo
Browse files Browse the repository at this point in the history
  • Loading branch information
vivek-arte committed Jul 20, 2023
1 parent ff7bd31 commit 1519739
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
1 change: 0 additions & 1 deletion qa/pull-tester/rpc-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@

ZSA_SCRIPTS = [
# These are tests for the ZSA protocol updates.
'issuance.py',
'demo-setup.py',
]

Expand Down
47 changes: 29 additions & 18 deletions qa/rpc-tests/demo-setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
start_nodes,
)

import sys, signal

def signal_handler(signal, frame):
print("\nProgram exiting gracefully")
sys.exit(0)

class IssueTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
Expand All @@ -32,23 +26,44 @@ def run_test(self):
# Sanity-check the test harness
assert_equal(self.nodes[0].getblockcount(), 200)

# Get a new Orchard account on node 0
acct0 = self.nodes[0].z_getnewaccount()['account']
ua0 = self.nodes[0].z_getaddressforaccount(acct0, ['orchard'])['address']
# Get a new Orchard account on node 0 (Alice)
acct0_alice = self.nodes[0].z_getnewaccount()['account']
ua0_alice = self.nodes[0].z_getaddressforaccount(acct0_alice, ['orchard'])['address']

# Get a new Orchard account on node 1
acct1 = self.nodes[1].z_getnewaccount()['account']
ua1 = self.nodes[1].z_getaddressforaccount(acct1, ['orchard'])['address']
# Get a new Orchard account on node 1 (Felix)
acct0_felix = self.nodes[1].z_getnewaccount()['account']
ua0_felix = self.nodes[1].z_getaddressforaccount(acct0_felix, ['orchard'])['address']

# Get a new Orchard account on node 2 (Bob)
acct0_bob = self.nodes[2].z_getnewaccount()['account']
ua0_bob = self.nodes[2].z_getaddressforaccount(acct0_bob, ['orchard'])['address']

# Activate NU5
self.nodes[0].generate(5)
self.sync_all()

# Print details post account setup:

#Alice:
print("\n\nAlice's Unified Address on Account 0 is:", ua0_alice)
print("\nAlice's wallet details:\n")
print(self.nodes[0].getwalletinfo())

#Felix:
print("\n\nFelix's Unified Address on Account 0 is:", ua0_felix)
print("\nFelix's wallet details:\n")
print(self.nodes[1].getwalletinfo())

#Bob:
print("\n\nBob's Unified Address on Account 0 is:", ua0_bob)
print("\nBob's wallet details:\n")
print(self.nodes[2].getwalletinfo())

# Issue assets to an address on node 0
self.nodes[0].issue(0, ua0, "WBTC", 4001, True)
self.nodes[0].issue(0, ua0_alice, "WBTC", 4001, True)

# Issue assets to an address on node 1
self.nodes[0].issue(0, ua1, "WBTC", 42, True)
self.nodes[0].issue(0, ua0_felix, "WBTC", 42, True)

self.sync_all()
self.nodes[0].generate(1)
Expand All @@ -68,8 +83,4 @@ def run_test(self):
assert_equal(value['confirmed_balance'], 42)

if __name__ == '__main__':
signal.signal(signal.SIGINT, signal_handler)
IssueTest().main()
while true:
print(".")

0 comments on commit 1519739

Please sign in to comment.