Skip to content
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

check invalid pubkey handle in utxo contract #2096

Closed
popcnt1 opened this issue Jul 7, 2024 · 1 comment
Closed

check invalid pubkey handle in utxo contract #2096

popcnt1 opened this issue Jul 7, 2024 · 1 comment
Assignees
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@popcnt1
Copy link
Collaborator

popcnt1 commented Jul 7, 2024

for p2pk script we may have some invalid pubkey:

https://www.blockchain.com/explorer/transactions/btc/41a3e9ee1910a2d40dd217bbc9fd3638c40d13c8fdda8a0aa9d49a2b4a199422

In utxo import cmd, using default address:

#2094

@popcnt1 popcnt1 added help wanted Extra attention is needed question Further information is requested labels Jul 7, 2024
@popcnt1
Copy link
Collaborator Author

popcnt1 commented Jul 10, 2024

@jolestar

in rooch-types/src/bitcoin/types.rs:

impl From<bitcoin::TxOut> for TxOut {
    fn from(tx_out: bitcoin::TxOut) -> Self {
        let address_opt = bitcoin::address::Payload::from_script(&tx_out.script_pubkey).ok();
        Self {
            value: tx_out.value.to_sat(),
            script_pubkey: tx_out.script_pubkey.into(),
            recipient_address: address_opt
                .map(|address| address.into())
                .unwrap_or_default(),
        }
    }
}

If we cannot get the addresss will use default(empty vec) , in move contract:

image

empty address will be transfer to bitcoin_move_addresss, as same as new changes in import process #2094 when we meet invalid address

@popcnt1 popcnt1 closed this as completed Jul 11, 2024
@github-project-automation github-project-automation bot moved this to Done in Rooch Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
Status: Done
Development

No branches or pull requests

2 participants