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

feat(stack): implement control flow and checktimelock #2217

Closed
wants to merge 10 commits into from
2 changes: 1 addition & 1 deletion node/src/actors/chain_manager/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ impl Handler<BuildScriptTransaction> for ChainManager {
.into_actor(self)
tmpolaczyk marked this conversation as resolved.
Show resolved Hide resolved
.then(|s, _act, _ctx| match s {
Ok(_signatures) => {
let multi_sig_witness = witnet_stack::encode(vec![]);
let multi_sig_witness = witnet_stack::encode(vec![]).unwrap();
let num_inputs = vtt.inputs.len();
let transaction = Transaction::ValueTransfer(VTTransaction {
body: vtt,
Expand Down
8 changes: 4 additions & 4 deletions src/cli/node/json_rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ pub fn create_multisig_address(
]);

let locking_script_hash =
PublicKeyHash::from_script_bytes(&witnet_stack::encode(redeem_script));
PublicKeyHash::from_script_bytes(&witnet_stack::encode(redeem_script)?);

println!(
"Sending to {}-of-{} multisig address {} composed of {:?}",
Expand Down Expand Up @@ -778,7 +778,7 @@ pub fn create_opened_multisig(
Item::Value(MyValue::Integer(i128::from(n))),
Item::Operator(MyOperator::CheckMultiSig),
]);
let redeem_script_bytes = witnet_stack::encode(redeem_script);
let redeem_script_bytes = witnet_stack::encode(redeem_script)?;
let vt_outputs = vec![ValueTransferOutput {
pkh: address,
value,
Expand Down Expand Up @@ -854,13 +854,13 @@ pub fn sign_tx(addr: SocketAddr, hex: String, dry_run: bool) -> Result<(), failu
match tx {
Transaction::ValueTransfer(ref mut vtt) => {
let signature_bytes = signature.to_pb_bytes()?;
let mut script = witnet_stack::decode(&vtt.witness[0]);
let mut script = witnet_stack::decode(&vtt.witness[0])?;

println!("Previous script:\n{:?}", script);
script.push(Item::Value(MyValue::Signature(signature_bytes)));

println!("Post script:\n{:?}", script);
let encoded_script = witnet_stack::encode(script);
let encoded_script = witnet_stack::encode(script)?;

vtt.witness[0] = encoded_script;

Expand Down
Loading