mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-15 20:07:19 +00:00
Wallet throws on missing signature by default
Using dummy sigs by default may be confusing for multi-sig scenarios. See: https://groups.google.com/forum/#!topic/bitcoinj/PEhZGk3WMxU
This commit is contained in:
committed by
Mike Hearn
parent
ae24da4f9c
commit
c2d19a31a8
@@ -3028,10 +3028,10 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
||||
|
||||
/**
|
||||
* Specifies what to do with missing signatures left after completing this request. Default strategy is to
|
||||
* replace missing signatures with dummy sigs ({@link MissingSigsMode#USE_DUMMY_SIG}).
|
||||
* throw an exception on missing signature ({@link MissingSigsMode#THROW}).
|
||||
* @see MissingSigsMode
|
||||
*/
|
||||
public MissingSigsMode missingSigsMode = MissingSigsMode.USE_DUMMY_SIG;
|
||||
public MissingSigsMode missingSigsMode = MissingSigsMode.THROW;
|
||||
|
||||
/**
|
||||
* If not null, this exchange rate is recorded with the transaction during completion.
|
||||
|
||||
@@ -394,6 +394,7 @@ public class PaymentChannelServerState {
|
||||
signMultisigInput(tx, Transaction.SigHash.NONE, true);
|
||||
// Let wallet handle adding additional inputs/fee as necessary.
|
||||
req.shuffleOutputs = false;
|
||||
req.missingSigsMode = Wallet.MissingSigsMode.USE_DUMMY_SIG;
|
||||
wallet.completeTx(req); // TODO: Fix things so shuffling is usable.
|
||||
feePaidForPayment = req.tx.getFee();
|
||||
log.info("Calculated fee is {}", feePaidForPayment);
|
||||
|
||||
@@ -2449,6 +2449,16 @@ public class WalletTest extends TestWithWallet {
|
||||
completeTxPartiallySignedMarried(Wallet.MissingSigsMode.THROW, emptySig);
|
||||
}
|
||||
|
||||
@Test (expected = TransactionSigner.MissingSignatureException.class)
|
||||
public void completeTxPartiallySignedMarriedThrowsByDefault() throws Exception {
|
||||
createMarriedWallet(false);
|
||||
myAddress = wallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||
sendMoneyToWallet(wallet, COIN, myAddress, AbstractBlockChain.NewBlockType.BEST_CHAIN);
|
||||
|
||||
Wallet.SendRequest req = Wallet.SendRequest.emptyWallet(new ECKey().toAddress(params));
|
||||
wallet.completeTx(req);
|
||||
}
|
||||
|
||||
public void completeTxPartiallySignedMarried(Wallet.MissingSigsMode missSigMode, byte[] expectedSig) throws Exception {
|
||||
// create married wallet without signer
|
||||
createMarriedWallet(false);
|
||||
|
||||
Reference in New Issue
Block a user