@Override public String toString() { if (!analyzed) return "Pending risk analysis for " + tx.getHashAsString(); else if (nonFinal != null) return "Risky due to non-finality of " + nonFinal.getHashAsString(); else if (nonStandard != null) return "Risky due to non-standard tx " + nonStandard.getHashAsString(); else return "Non-risky"; }
@Override public String toString() { if (!analyzed) return "Pending risk analysis for " + tx.getHashAsString(); else if (nonFinal != null) return "Risky due to non-finality of " + nonFinal.getHashAsString(); else if (nonStandard != null) return "Risky due to non-standard tx " + nonStandard.getHashAsString(); else return "Non-risky"; }
/** * @param transaction The Bitcoinj transaction providing the information * @param progress The broadcast progress of the transaction */ public BitcoinSendProgressEvent(Transaction transaction, double progress) { Preconditions.checkNotNull(transaction); transactionId = transaction.getHashAsString(); this.progress = progress; }
@Override public void run() { // The wallet has changed now, it'll get auto saved shortly or when the app shuts down. System.out.println("Sent coins onwards! Transaction hash is " + sendResult.tx.getHashAsString()); } }, MoreExecutors.sameThreadExecutor());
@Override public void onFailure(Throwable throwable) { log.error("Could not download dependencies of tx {}", tx.getHashAsString()); log.error("Error was: ", throwable); // Not much more we can do at this point. } });
@Override public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) { // Runs in a peer thread. System.out.println(tx.getHashAsString()); latch.countDown(); // Wake up main thread. } });
@Override public void onFailure(Throwable throwable) { log.error("Could not download dependencies of tx {}", tx.getHashAsString()); log.error("Error was: ", throwable); // Not much more we can do at this point. } });
@Override public void onFailure(Throwable throwable) { log.error("Could not download dependencies of tx {}", tx.getHashAsString()); log.error("Error was: ", throwable); // Not much more we can do at this point. } });
@Override public void onFailure(Throwable throwable) { log.error("Could not download dependencies of tx {}", tx.getHashAsString()); log.error("Error was: ", throwable); // Not much more we can do at this point. } });
@Override public synchronized void onCoinsReceived(Wallet w, Transaction tx, Coin prevBalance, Coin newBalance) { System.out.println("\nReceived tx " + tx.getHashAsString()); System.out.println(tx.toString()); } });
@Override public void onSuccess(Transaction transaction) { log.info("Successfully broadcast multisig contract {}. Channel now open.", transaction.getHashAsString()); try { // Manually add the contract to the wallet, overriding the isRelevant checks so we can track // it and check for double-spends later wallet.receivePending(contract, null, true); } catch (VerificationException e) { throw new RuntimeException(e); // Cannot happen, we already called contract.verify() } stateMachine.transition(State.READY); future.set(PaymentChannelServerState.this); }
@Override public void onSuccess(Transaction transaction) { log.info("Successfully broadcast multisig contract {}. Channel now open.", transaction.getHashAsString()); try { // Manually add the contract to the wallet, overriding the isRelevant checks so we can track // it and check for double-spends later wallet.receivePending(contract, null, true); } catch (VerificationException e) { throw new RuntimeException(e); // Cannot happen, we already called contract.verify() } stateMachine.transition(State.READY); future.set(PaymentChannelServerState.this); }
@Override public void onSuccess(Transaction transaction) { log.info("Successfully broadcast multisig contract {}. Channel now open.", transaction.getHashAsString()); try { // Manually add the contract to the wallet, overriding the isRelevant checks so we can track // it and check for double-spends later wallet.receivePending(contract, null, true); } catch (VerificationException e) { throw new RuntimeException(e); // Cannot happen, we already called contract.verify() } stateMachine.transition(State.READY); future.set(PaymentChannelServerState.this); }
@Override public void onCoinsSent(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) { Log.d(TAG, "onCoinsSent: " + tx.getHashAsString() + "preBalance: " + prevBalance.getValue() + "newBalance: " + newBalance.getValue()); updateUI(wallet); }
@Override public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) { Log.d(TAG, "onCoinsReceived: " + tx.getHashAsString() + "prevBalance" + prevBalance.getValue() + "newBalance " + newBalance.getValue()); updateUI(wallet); }
@Test public void hashes() { assertEquals(TX_HASH_1, TX_1.getHashAsString()); assertEquals(TX_HASH_2, TX_2.getHashAsString()); assertEquals(TX_HASH_3, TX_3.getHashAsString()); } @Test
@Test public void hashes() { assertEquals(TX_HASH_1, TX_1.getHashAsString()); assertEquals(TX_HASH_2, TX_2.getHashAsString()); assertEquals(TX_HASH_3, TX_3.getHashAsString()); } @Test
@Test public void cannacoinTxTest() { assertEquals(cannacoinHash, cannacoinTx.getHashAsString()); } }
@Test public void cannacoinTxTest() { assertEquals(cannacoinHash, cannacoinTx.getHashAsString()); } }
@Test public void roundtripVersionTwoTransaction() throws Exception { Transaction tx = new Transaction(PARAMS, Utils.HEX.decode( "0200000001d7902864af9310420c6e606b814c8f89f7902d40c130594e85df2e757a7cc301070000006b483045022100ca1757afa1af85c2bb014382d9ce411e1628d2b3d478df9d5d3e9e93cb25dcdd02206c5d272b31a23baf64e82793ee5c816e2bbef251e733a638b630ff2331fc83ba0121026ac2316508287761befbd0f7495ea794b396dbc5b556bf276639f56c0bd08911feffffff0274730700000000001976a91456da2d038a098c42390c77ef163e1cc23aedf24088ac91062300000000001976a9148ebf3467b9a8d7ae7b290da719e61142793392c188ac22e00600")); assertEquals(tx.getVersion(), 2); assertEquals(tx.getHashAsString(), "0321b1413ed9048199815bd6bc2650cab1a9e8d543f109a42c769b1f18df4174"); myWallet.addWalletTransaction(new WalletTransaction(Pool.UNSPENT, tx)); Wallet wallet1 = roundTrip(myWallet); Transaction tx2 = wallet1.getTransaction(tx.getHash()); assertEquals(checkNotNull(tx2).getVersion(), 2); }