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:
parent
1277df32d8
commit
e6965d0217
@ -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;
|
||||
|
@ -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.
|
||||
}
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user