mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 10:15:52 +00:00
Payment channels: minor comment change and simplification.
This commit is contained in:
parent
14dae15150
commit
b9aa1e4d1e
@ -23,7 +23,6 @@ import com.google.bitcoin.script.ScriptBuilder;
|
||||
import com.google.bitcoin.utils.Threading;
|
||||
import com.google.bitcoin.wallet.AllowUnconfirmedCoinSelector;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -326,7 +325,7 @@ public class PaymentChannelClientState {
|
||||
TransactionSignature ourSignature =
|
||||
refundTx.calculateSignature(0, myKey, multisigScript, Transaction.SigHash.ALL, false);
|
||||
// Insert the signatures.
|
||||
Script scriptSig = ScriptBuilder.createMultiSigInputScript(ImmutableList.of(ourSignature, theirSig));
|
||||
Script scriptSig = ScriptBuilder.createMultiSigInputScript(ourSignature, theirSig);
|
||||
log.info("Refund scriptSig: {}", scriptSig);
|
||||
log.info("Multi-sig contract scriptPubKey: {}", multisigScript);
|
||||
TransactionInput refundInput = refundTx.getInput(0);
|
||||
|
@ -32,7 +32,6 @@ import org.slf4j.LoggerFactory;
|
||||
import javax.annotation.Nullable;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
|
||||
@ -394,9 +393,13 @@ public class PaymentChannelServerState {
|
||||
try {
|
||||
Wallet.SendRequest req = makeUnsignedChannelContract(bestValueToMe);
|
||||
tx = req.tx;
|
||||
// Provide a BS signature so that completeTx wont freak out about unsigned inputs.
|
||||
// Provide a throwaway signature so that completeTx won't complain out about unsigned inputs it doesn't
|
||||
// know how to sign. Note that this signature does actually have to be valid, so we can't use a dummy
|
||||
// signature to save time, because otherwise completeTx will try to re-sign it to make it valid and then
|
||||
// die. We could probably add features to the SendRequest API to make this a bit more efficient.
|
||||
signMultisigInput(tx, Transaction.SigHash.NONE, true);
|
||||
if (!wallet.completeTx(req)) // Let wallet handle adding additional inputs/fee as necessary.
|
||||
// Let wallet handle adding additional inputs/fee as necessary.
|
||||
if (!wallet.completeTx(req))
|
||||
throw new ValueOutOfRangeException("Unable to complete transaction - unable to pay required fee");
|
||||
feePaidForPayment = req.fee;
|
||||
log.info("Calculated fee is {}", feePaidForPayment);
|
||||
|
Loading…
x
Reference in New Issue
Block a user