Taproot Outputs spend capacity
This commit is contained in:
parent
1a74ca0f4d
commit
b7d102ec12
@ -92,6 +92,9 @@
|
|||||||
},
|
},
|
||||||
bech32Address: {
|
bech32Address: {
|
||||||
value: key => coinjs.bech32Address(btcOperator.pubkey(key)).address
|
value: key => coinjs.bech32Address(btcOperator.pubkey(key)).address
|
||||||
|
},
|
||||||
|
bech32mAddress: {
|
||||||
|
value: key => segwit_addr.encode("bc",1,key)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -107,6 +110,8 @@
|
|||||||
return btcOperator.segwitAddress(key) === addr;
|
return btcOperator.segwitAddress(key) === addr;
|
||||||
case "bech32":
|
case "bech32":
|
||||||
return btcOperator.bech32Address(key) === addr;
|
return btcOperator.bech32Address(key) === addr;
|
||||||
|
case "bech32m":
|
||||||
|
return btcOperator.bech32mAddress(key) === addr; // Key is a byte array of 32 bytes
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -116,7 +121,7 @@
|
|||||||
if (!addr)
|
if (!addr)
|
||||||
return undefined;
|
return undefined;
|
||||||
let type = coinjs.addressDecode(addr).type;
|
let type = coinjs.addressDecode(addr).type;
|
||||||
if (["standard", "multisig", "bech32", "multisigBech32"].includes(type))
|
if (["standard", "multisig", "bech32", "multisigBech32","bech32m"].includes(type))
|
||||||
return type;
|
return type;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
@ -281,6 +286,7 @@
|
|||||||
BECH32_OUTPUT_SIZE = 23,
|
BECH32_OUTPUT_SIZE = 23,
|
||||||
BECH32_MULTISIG_OUTPUT_SIZE = 34,
|
BECH32_MULTISIG_OUTPUT_SIZE = 34,
|
||||||
SEGWIT_OUTPUT_SIZE = 23;
|
SEGWIT_OUTPUT_SIZE = 23;
|
||||||
|
BECH32M_OUTPUT_SIZE = 35; // Check this later
|
||||||
|
|
||||||
function _redeemScript(addr, key) {
|
function _redeemScript(addr, key) {
|
||||||
let decode = coinjs.addressDecode(addr);
|
let decode = coinjs.addressDecode(addr);
|
||||||
@ -291,6 +297,8 @@
|
|||||||
return key ? coinjs.segwitAddress(btcOperator.pubkey(key)).redeemscript : null;
|
return key ? coinjs.segwitAddress(btcOperator.pubkey(key)).redeemscript : null;
|
||||||
case "bech32":
|
case "bech32":
|
||||||
return decode.redeemscript;
|
return decode.redeemscript;
|
||||||
|
case "bech32m":
|
||||||
|
return decode.outstring; //Maybe the redeemscript will come when input processing happens for bech32m
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -328,6 +336,8 @@
|
|||||||
return BASE_OUTPUT_SIZE + BECH32_MULTISIG_OUTPUT_SIZE;
|
return BASE_OUTPUT_SIZE + BECH32_MULTISIG_OUTPUT_SIZE;
|
||||||
case "multisig":
|
case "multisig":
|
||||||
return BASE_OUTPUT_SIZE + SEGWIT_OUTPUT_SIZE;
|
return BASE_OUTPUT_SIZE + SEGWIT_OUTPUT_SIZE;
|
||||||
|
case "bech32m":
|
||||||
|
return BASE_OUTPUT_SIZE + BECH32M_OUTPUT_SIZE;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user