mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 18:25:51 +00:00
Add a Transaction.getValue(Wallet) method.
This commit is contained in:
parent
ddb6da155b
commit
40bd728703
@ -288,6 +288,13 @@ public class Transaction extends ChildMessage implements Serializable {
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the difference of {@link Transaction#getValueSentFromMe(Wallet)} and {@link Transaction#getValueSentToMe(Wallet)}.
|
||||
*/
|
||||
public BigInteger getValue(Wallet wallet) throws ScriptException {
|
||||
return getValueSentToMe(wallet).subtract(getValueSentFromMe(wallet));
|
||||
}
|
||||
|
||||
boolean disconnectInputs() {
|
||||
boolean disconnected = false;
|
||||
maybeParse();
|
||||
|
@ -251,6 +251,7 @@ public class WalletTest {
|
||||
// Reserialize.
|
||||
Transaction send2 = new Transaction(params, send1.bitcoinSerialize());
|
||||
assertEquals(nanos, send2.getValueSentFromMe(wallet));
|
||||
assertEquals(BigInteger.ZERO.subtract(toNanoCoins(0, 10)), send2.getValue(wallet));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user