mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-14 11:28:00 +00:00
Transaction: Add getTxId() and getWTxId(); deprecate getHash() and getHashAsString().
This commit is contained in:
@@ -53,7 +53,7 @@ public class FetchTransactions {
|
||||
System.out.println("Waiting for node to send us the dependencies ...");
|
||||
List<Transaction> deps = peer.downloadDependencies(tx).get();
|
||||
for (Transaction dep : deps) {
|
||||
System.out.println("Got dependency " + dep.getHashAsString());
|
||||
System.out.println("Got dependency " + dep.getTxId());
|
||||
}
|
||||
|
||||
System.out.println("Done.");
|
||||
|
||||
@@ -145,7 +145,7 @@ public class ForwardingService {
|
||||
@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());
|
||||
System.out.println("Sent coins onwards! Transaction hash is " + sendResult.tx.getTxId());
|
||||
}
|
||||
}, MoreExecutors.directExecutor());
|
||||
} catch (KeyCrypterException | InsufficientMoneyException e) {
|
||||
|
||||
@@ -108,7 +108,7 @@ public class GenerateLowSTests {
|
||||
// First output a conventional low-S transaction with the LOW_S flag, for the tx_valid.json set
|
||||
System.out.println("[\"A transaction with a low-S signature.\"],");
|
||||
System.out.println("[[[\""
|
||||
+ inputTransaction.getHashAsString() + "\", "
|
||||
+ inputTransaction.getTxId() + "\", "
|
||||
+ output.getIndex() + ", \""
|
||||
+ scriptToString(output.getScriptPubKey()) + "\"]],\n"
|
||||
+ "\"" + Utils.HEX.encode(proposedTransaction.partialTx.unsafeBitcoinSerialize()) + "\", \""
|
||||
@@ -123,7 +123,7 @@ public class GenerateLowSTests {
|
||||
// A high-S transaction without the LOW_S flag, for the tx_valid.json set
|
||||
System.out.println("[\"A transaction with a high-S signature.\"],");
|
||||
System.out.println("[[[\""
|
||||
+ inputTransaction.getHashAsString() + "\", "
|
||||
+ inputTransaction.getTxId() + "\", "
|
||||
+ output.getIndex() + ", \""
|
||||
+ scriptToString(output.getScriptPubKey()) + "\"]],\n"
|
||||
+ "\"" + Utils.HEX.encode(proposedTransaction.partialTx.unsafeBitcoinSerialize()) + "\", \""
|
||||
@@ -132,7 +132,7 @@ public class GenerateLowSTests {
|
||||
// Lastly a conventional high-S transaction with the LOW_S flag, for the tx_invalid.json set
|
||||
System.out.println("[\"A transaction with a high-S signature.\"],");
|
||||
System.out.println("[[[\""
|
||||
+ inputTransaction.getHashAsString() + "\", "
|
||||
+ inputTransaction.getTxId() + "\", "
|
||||
+ output.getIndex() + ", \""
|
||||
+ scriptToString(output.getScriptPubKey()) + "\"]],\n"
|
||||
+ "\"" + Utils.HEX.encode(proposedTransaction.partialTx.unsafeBitcoinSerialize()) + "\", \""
|
||||
|
||||
@@ -68,7 +68,7 @@ public class Kit {
|
||||
kit.wallet().addCoinsReceivedEventListener(new WalletCoinsReceivedEventListener() {
|
||||
@Override
|
||||
public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
||||
System.out.println("-----> coins resceived: " + tx.getHashAsString());
|
||||
System.out.println("-----> coins resceived: " + tx.getTxId());
|
||||
System.out.println("received: " + tx.getValue(wallet));
|
||||
}
|
||||
});
|
||||
@@ -97,7 +97,7 @@ public class Kit {
|
||||
kit.wallet().addTransactionConfidenceEventListener(new TransactionConfidenceEventListener() {
|
||||
@Override
|
||||
public void onTransactionConfidenceChanged(Wallet wallet, Transaction tx) {
|
||||
System.out.println("-----> confidence changed: " + tx.getHashAsString());
|
||||
System.out.println("-----> confidence changed: " + tx.getTxId());
|
||||
TransactionConfidence confidence = tx.getConfidence();
|
||||
System.out.println("new block depth: " + confidence.getDepthInBlocks());
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class RefreshWallet {
|
||||
wallet.addCoinsReceivedEventListener(new WalletCoinsReceivedEventListener() {
|
||||
@Override
|
||||
public synchronized void onCoinsReceived(Wallet w, Transaction tx, Coin prevBalance, Coin newBalance) {
|
||||
System.out.println("\nReceived tx " + tx.getHashAsString());
|
||||
System.out.println("\nReceived tx " + tx.getTxId());
|
||||
System.out.println(tx.toString());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ public class SendRequest {
|
||||
// In this example we catch the InsufficientMoneyException and register a BalanceFuture callback that runs once the wallet has enough balance.
|
||||
try {
|
||||
Wallet.SendResult result = kit.wallet().sendCoins(kit.peerGroup(), to, value);
|
||||
System.out.println("coins sent. transaction hash: " + result.tx.getHashAsString());
|
||||
System.out.println("coins sent. transaction hash: " + result.tx.getTxId());
|
||||
// you can use a block explorer like https://www.biteasy.com/ to inspect the transaction with the printed transaction hash.
|
||||
} catch (InsufficientMoneyException e) {
|
||||
System.out.println("Not enough coins in your wallet. Missing " + e.missing.getValue() + " satoshis are missing (including fees)");
|
||||
|
||||
Reference in New Issue
Block a user