-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add utility methods for multisig script #30
Conversation
These methods is used esplora-tapyrus(chaintope/esplora-tapyrus#9) |
src/blockdata/script.rs
Outdated
pub fn get_multisig_pubkeys(&self) -> Result<(i32, Vec<PublicKey>), MultisigError> { | ||
if !self.is_multisig() { | ||
return Err(MultisigError::IsNotMultisig); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this check, all later InvalidRequiredSigCount
and InvalidPublicKey
errors are also IsNotMultisig
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove InvalidRequiredSigCount
and InvalidPublicKey
} else { | ||
"nonstandard".to_string() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum AddressType
is defined in src/util/address.rs
and Display
trait for string notation is implemented. How about extends it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method(type_string) is also intended to return script types including non-p2pkh or non-p2sh such as 'OP_RETURN ...'., while AddressType can not be defined for non-standard or op_return script.
Tapyrus-Core implementation: https://github.com/chaintope/tapyrus-core/blob/0a69fa72d394d7cf9119a718f8385f88c5323866/src/script/standard.cpp#L32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(But we should update AddressType later because AddressType doesnt include colored coin address)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for non-standard or op_return script.
Right. Is it a script type rather than an address type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add struct ScriptType
(cf188c4)
4d30674
to
c1dfce2
Compare
Add utility methods for multisig script.