3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 23:32:16 +00:00

Wallet: Check if tx is time-locked not just has a lock time

This commit is contained in:
Matt Corallo 2013-05-23 14:06:57 +02:00 committed by Mike Hearn
parent e2fea77a3d
commit 07baa230f3
2 changed files with 4 additions and 3 deletions

View File

@ -860,11 +860,11 @@ public class Wallet implements Serializable, BlockChainListener {
private static AnalysisResult analyzeTransactionAndDependencies(Transaction tx, List<Transaction> dependencies) {
AnalysisResult result = new AnalysisResult();
if (tx.getLockTime() > 0)
if (tx.isTimeLocked())
result.timeLocked = tx;
if (dependencies != null) {
for (Transaction dep : dependencies) {
if (dep.getLockTime() > 0) {
if (dep.isTimeLocked()) {
result.timeLocked = dep;
}
}
@ -897,7 +897,7 @@ public class Wallet implements Serializable, BlockChainListener {
return false;
}
if (tx.getLockTime() > 0 && !acceptTimeLockedTransactions) {
if (tx.isTimeLocked() && !acceptTimeLockedTransactions) {
log.warn("Received transaction {} with a lock time of {}, but not configured to accept these, discarding",
tx.getHashAsString(), tx.getLockTime());
return false;

View File

@ -702,6 +702,7 @@ public class PeerTest extends TestWithNetworkConnections {
// Add a fake input to t3 that goes nowhere.
Sha256Hash t3 = Sha256Hash.create("abc".getBytes(Charset.forName("UTF-8")));
t2.addInput(new TransactionInput(unitTestParams, t2, new byte[]{}, new TransactionOutPoint(unitTestParams, 0, t3)));
t2.getInput(0).setSequenceNumber(0xDEADBEEF);
t2.addOutput(Utils.toNanoCoins(1, 0), new ECKey());
Transaction t1 = new Transaction(unitTestParams);
t1.addInput(t2.getOutput(0));