aboutsummaryrefslogtreecommitdiffstats
path: root/lib/buildtx.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-09-12 15:47:00 -0700
committerAdam Soltys <[email protected]>2020-09-12 15:47:00 -0700
commit3ae6e9e46956416164c4540881a3acb81aa0c672 (patch)
treef28870ff7c787a3d54527909da8893380c6d66a9 /lib/buildtx.js
parentd712bf317f17e75f335c5c9a4a172f50c0ed4449 (diff)
downloadcoinos-server-3ae6e9e46956416164c4540881a3acb81aa0c672.tar.gz
coinos-server-3ae6e9e46956416164c4540881a3acb81aa0c672.zip
support rbf
Diffstat (limited to 'lib/buildtx.js')
-rw-r--r--lib/buildtx.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/buildtx.js b/lib/buildtx.js
index ef24ea19..0f63f641 100644
--- a/lib/buildtx.js
+++ b/lib/buildtx.js
@@ -8,7 +8,7 @@ const network = prod
? bitcoin.networks["bitcoin"]
: bitcoin.networks["regtest"];
-module.exports = async ({ address, amount, feeRate, user }) => {
+module.exports = async ({ address, amount, feeRate, replaceable, user }) => {
if (!feeRate) feeRate = (await bc.estimateSmartFee(6)).feerate * SATS;
feeRate = Math.round(feeRate / 1000);
@@ -69,6 +69,8 @@ module.exports = async ({ address, amount, feeRate, user }) => {
});
}
+ if (replaceable) psbt.setInputSequence(0, 0xffffffff - 2);
+
feeRate = Math.round(feeRate * 1000);
psbt = psbt.toBase64();