1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +00:00

Merge pull request #15 from jhoenicke/segwit

Prepare protocol for segwit.
This commit is contained in:
Pavol Rusnak 2016-07-11 16:07:32 +02:00 committed by GitHub
commit b29db007f9
2 changed files with 14 additions and 7 deletions

View File

@ -291,6 +291,7 @@ message GetAddress {
optional string coin_name = 2 [default='Bitcoin']; optional string coin_name = 2 [default='Bitcoin'];
optional bool show_display = 3; // optionally show on display before sending the result optional bool show_display = 3; // optionally show on display before sending the result
optional MultisigRedeemScriptType multisig = 4; // Filled if we are showing a multisig address optional MultisigRedeemScriptType multisig = 4; // Filled if we are showing a multisig address
optional InputScriptType script_type = 5 [default=SPENDADDRESS]; // Used to distinguish segwit addresses
} }
/** /**

View File

@ -45,10 +45,12 @@ enum FailureType {
* @used_in TxOutputType * @used_in TxOutputType
*/ */
enum OutputScriptType { enum OutputScriptType {
PAYTOADDRESS = 0; PAYTOADDRESS = 0; // used for all addresses (bitcoin, p2sh, witness)
PAYTOSCRIPTHASH = 1; PAYTOSCRIPTHASH = 1; // p2sh address (deprecated; use PAYTOADDRESS)
PAYTOMULTISIG = 2; PAYTOMULTISIG = 2; // only for change output
PAYTOOPRETURN = 3; PAYTOOPRETURN = 3; // op_return
PAYTOWITNESS = 4; // only for change output
PAYTOP2SHWITNESS = 5; // only for change output
} }
/** /**
@ -56,8 +58,11 @@ enum OutputScriptType {
* @used_in TxInputType * @used_in TxInputType
*/ */
enum InputScriptType { enum InputScriptType {
SPENDADDRESS = 0; SPENDADDRESS = 0; // standard p2pkh address
SPENDMULTISIG = 1; SPENDMULTISIG = 1; // p2sh multisig address
EXTERNAL = 2; // reserved for external inputs (coinjoin)
SPENDWITNESS = 3; // native segwit
SPENDP2SHWITNESS = 4; // segwit over p2sh (backward compatible)
} }
/** /**
@ -159,6 +164,7 @@ message TxInputType {
optional uint32 sequence = 5 [default=0xffffffff]; // sequence optional uint32 sequence = 5 [default=0xffffffff]; // sequence
optional InputScriptType script_type = 6 [default=SPENDADDRESS]; // defines template of input script optional InputScriptType script_type = 6 [default=SPENDADDRESS]; // defines template of input script
optional MultisigRedeemScriptType multisig = 7; // Filled if input is going to spend multisig tx optional MultisigRedeemScriptType multisig = 7; // Filled if input is going to spend multisig tx
optional uint64 amount = 8; // amount of previous transaction output (for segwit only)
} }
/** /**