public void BuildVoteMessageTest() { Wallet w = new Wallet("1E5B4C6DDDB2BDD6B40344808812D6D3254D7D4E105A52BA51C032EB7BAC1035", Network.Test); w.SetSequence(0);//Have to reset, wallet automatically refreshes it's sequence on creation var msgBytes = BroadcastMessageBuilder.BuildVoteMessage(3, VoteOptions.OptionAbstain, w); var msgStr = BitConverter.ToString(msgBytes).Replace("-", "").ToUpper(); var expectedStr = "9401F0625DEE0A1EA1CADD36080312141B0A2CFFAE1193EE0BDE3E01C62E34D82E3BFA0A1802126E0A26EB5AE9872103D2B6A5194D34703971E6C7544B2E5CE687AF7CF58346F662936D8E26C20A301312405C0AFBBFB819190D5A9794CE3F2BB2216BFCCEEB9B4EF378FE2B967B7775B4FF2795216ED6C7282D473E367F474A66EC0E13B4523BE06B4397778134AB8E158918ECE028"; Assert.AreEqual(msgStr, expectedStr); }
public BroadcastResponse Vote(int proposal_id, VoteOptions option) { //Ensure no other broadcast transaction interferes with sequence until it hit the blockchain lock (BroadcastLockObject) { if (VerifySequenceBeforeSend) { Wallet.RefreshSequence(); } var msg = BroadcastMessageBuilder.BuildVoteMessage(proposal_id, option, Wallet); var result = HTTP.BroadcastToBlockchain(msg, WaitForTransactionConfirmationOnBroadcast); if (result.ok) { _wallet.IncrementSequence(); } return(result); } }