def main args Array String implicit val atMost minutes Nxt main Array

 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
48
49
50
51
52
53
54
55
56
def main(args: Array[String]) {
implicit val atMost = 5.minutes
Nxt.main(Array())
Generator.startForging(phrase)
println("Height: "+Nxt.getBlockchain.getHeight)
val acc = Account.getAccount(Crypto.getPublicKey(phrase))
println("balance: "+acc.getBalanceNQT)
val pubKey = Crypto.getPublicKey(phrase)
val votingPhrase = "imvoterimvoterimvoterimvoter"
val voterId = Account.getId(Crypto.getPublicKey(votingPhrase))
val voterPk = Crypto.getPublicKey(votingPhrase)
val trb = Nxt.getTransactionProcessor.newTransactionBuilder(pubKey, Fee, Fee, defaultDeadline, Attachment.ORDINARY_PAYMENT)
trb.recipientId(voterId)
trb.publicKeyAnnouncement(new PublicKeyAnnouncement(voterPk))
val tr = trb.build()
tr.sign(phrase)
Nxt.getTransactionProcessor.broadcast(tr)
val h = Nxt.getBlockchain.getHeight
val b0 = balanceNqt(phrase)
val tb = Nxt.getTransactionProcessor.newTransactionBuilder(pubKey, 50*Fee, Fee, defaultDeadline, Attachment.ORDINARY_PAYMENT)
tb.twoPhased(new TwoPhased(h+13, Constants.VOTING_MODEL_ACCOUNT, 1, 0, Array[Long](voterId), null))
tb.recipientId(Genesis.CREATOR_ID)
val tx = tb.build()
tx.sign(phrase)
Nxt.getTransactionProcessor.broadcast(tx)
println("Pending tx id: "+tx.getId)
WaitingUtils.skipBlockSync()
println(s"0:balance diff ${b0-balanceNqt(phrase)}")
val vatt = new Attachment.PendingPaymentVoteCasting(tx.getId)
val vtb = Nxt.getTransactionProcessor.newTransactionBuilder(voterPk, 0, Fee, defaultDeadline, vatt)
val vtx = vtb.build()
vtx.sign(votingPhrase)
Nxt.getTransactionProcessor.broadcast(vtx)
WaitingUtils.skipBlocksSync(5)
println(s"1:balance diff ${b0-balanceNqt(phrase)}")