-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcreate_txs.sh
executable file
·48 lines (40 loc) · 1.18 KB
/
create_txs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/expect
set senderwallet "my_main"
set senderpassword ""
set amount "1.0"
set numwallets 2
set walletprefix "my_"
log_user 0
# send to self in order to create enough outputs
puts "sending 0.1 GRIN to myself and create [expr $numwallets + 1] change outputs"
spawn grin-wallet -d $senderwallet send -o [expr $numwallets + 1] -m self 0.1
expect "Password:"
send "$senderpassword\r"
lassign [wait] pid spawnid os_error_flag value
if {$os_error_flag == 0 && $value == 0} {
puts "==> ok\n"
} else {
puts "==> ERROR, aborting"
exit
}
puts "now I sleep for 10 minutes, so the outputs get confirmed...\n"
after 600000
for {set i 1} {$i <= $numwallets} {incr i} {
while {1} {
puts "tx $i: trying to create tx"
spawn ./grin-wallet -d $senderwallet send -d $walletprefix$i.tx -m file -s smallest $amount
expect "Password:"
send "$senderpassword\r"
lassign [wait] pid spawnid os_error_flag value
if {$os_error_flag == 0 && $value == 0} {
puts "tx $i: Created $walletprefix$i.tx\n"
break
} elseif {$os_error_flag == 0 && $value == 1} {
puts "tx $i: grin-wallet returned an error, trying again in a minute"
after 60000
} else {
puts "unknown error, EXIT"
exit 1
}
}
}