New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
txscript/v4/stdscript migration #1879
Conversation
dbtypes: ScriptClass type for stable string values TxRawResult -> MsgTx unless block info needed
Script classes are now being kept unchanged despite the more fine-grained stdscript types on account of the new api and db types in the following key places:
In addition to keeping the different stake subtypes combined (e.g. Running as expected on https://tip.dcrdata.org with dcrd 1.7/master. |
3 days on tip.dcrdata.org. script_type summary in postgres:
This indicates the stored script types are stable with The explorer pages are also showing the same script types, including the "sstxcommitment" pseudo-type, along with the script version: https://tip.dcrdata.org/tx/78f070e11fbccdfc2bb13e0f7b221c873d1656997ac47b91b90c3617d367170c API: "vout": [
{
"value": 196.73779166,
"n": 0,
"version": 0,
"scriptPubKey": {
"asm": "OP_SSTX OP_DUP OP_HASH160 064f47471cf7378c93b2330c9ac954cf69692b5d OP_EQUALVERIFY OP_CHECKSIG",
"hex": "ba76a914064f47471cf7378c93b2330c9ac954cf69692b5d88ac",
"version": 0,
"reqSigs": 1,
"type": "stakesubmission",
"addresses": [
"DsRYGWwfSz3pnGgWmSzAzLMVb9NrZWDVa19"
]
}
},
{
"value": 0,
"n": 1,
"version": 0,
"scriptPubKey": {
"asm": "OP_RETURN 2a372905e48a34601d842ff88bbed0d117932afa8217a694040000000058",
"hex": "6a1e2a372905e48a34601d842ff88bbed0d117932afa8217a694040000000058",
"version": 0,
"type": "sstxcommitment",
"addresses": [
"DsUp7x65r9eBnrzoeF6Y6ncZvuaLfXWdoSh"
],
"commitamt": 196.73782146
}
},
{
"value": 0,
"n": 2,
"version": 0,
"scriptPubKey": {
"asm": "OP_SSTXCHANGE OP_DUP OP_HASH160 0000000000000000000000000000000000000000 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "bd76a914000000000000000000000000000000000000000088ac",
"version": 0,
"reqSigs": 1,
"type": "sstxchange",
"addresses": [
"DsQxuVRvS4eaJ42dhQEsCXauMWjvopWgrVg"
]
}
}
] |
This migrates to the new txscript/v4/stdscript package.
New script class types in dbtypes and api/types are created to maintain the same script class strings.
This uncovered a pg DB bug that has existed since the birth of the dcrpg package. Tickets have always had the
is_multisig BOOL
column set tofalse
. A DB upgrade would be needed to identify p2sh tickets, or just remove theis_multisig
column entirely. I think the idea of this column was to distinguish solo (P2PKH) and legacy stakepool (P2SH) tickets. For some reason the code was checking the subtype of the stake submission but only settingis_multisig
was multisig, which was never the case since it is either pkh or sh. I've confirmed that there are no instances ofis_multisig
beingtrue
in a mainnettickets
table. I think I will remove this since clearly no one looks at the column, and the corresponding output type can be determined via thevouts
table.