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

Always accept time-locked txn we create, make refund tx source self

This commit is contained in:
Matt Corallo 2013-07-09 13:32:41 +02:00 committed by Mike Hearn
parent 1277df32d8
commit e6965d0217
3 changed files with 6 additions and 3 deletions

View File

@ -909,7 +909,7 @@ public class Wallet implements Serializable, BlockChainListener {
return false;
}
if (tx.isTimeLocked() && !acceptTimeLockedTransactions) {
if (tx.isTimeLocked() && !acceptTimeLockedTransactions && tx.getConfidence().getSource() != TransactionConfidence.Source.SELF) {
log.warn("Received transaction {} with a lock time of {}, but not configured to accept these, discarding",
tx.getHashAsString(), tx.getLockTime());
return false;

View File

@ -196,6 +196,7 @@ public class PaymentChannelClientState {
refundTx.addOutput(totalValue, myKey.toAddress(params));
refundFees = multisigFee;
}
refundTx.getConfidence().setSource(TransactionConfidence.Source.SELF);
state = State.INITIATED;
// Client should now call getIncompleteRefundTransaction() and send it to the server.
}

View File

@ -406,9 +406,11 @@ public class ChannelConnectionTest extends TestWithWallet {
StoredPaymentChannelClientStates newClientStates = new StoredPaymentChannelClientStates(mockBroadcaster, wallet);
newClientStates.deserializeWalletExtension(wallet, clientStoredChannels.serializeWalletExtension());
// Expect two pairs of contract/refund ...
for (int i = 0; i < 4; i++) {
for (int i = 0; i < 2; i++) {
broadcastTxPause.release();
broadcasts.take();
assertTrue(broadcasts.take().getOutput(0).getScriptPubKey().isSentToMultiSig());
broadcastTxPause.release();
assertEquals(TransactionConfidence.Source.SELF, broadcasts.take().getConfidence().getSource());
}
assertTrue(broadcasts.isEmpty());
assertTrue(newClientStates.mapChannels.isEmpty());