Skip to content

Commit

Permalink
fix spend
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden committed Jul 24, 2024
1 parent 002bf70 commit 51eb8c4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
9 changes: 5 additions & 4 deletions base_layer/core/src/blocks/pre_mine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#[cfg(test)]
mod test {
use std::convert::TryInto;

use std::{convert::TryFrom, fs::File, io::Write};
use std::{
convert::{TryFrom, TryInto},
fs::File,
io::Write,
};

use rand::{rngs::OsRng, seq::SliceRandom, thread_rng};
use tari_common_types::{
Expand Down Expand Up @@ -105,7 +107,6 @@ mod test {
let script = script!(
CheckHeight(lock_height + fail_safe_height) LeZero IfThen CheckMultiSigVerifyAggregatePubKey(signature_threshold,address_len,list_of_spend_keys.clone(),Box::new(commitment_bytes)) Else PushPubKey(Box::new(backup_address.public_spend_key().clone())) EndIf
);
dbg!(&script.as_slice().get(3));
let output = WalletOutputBuilder::new(amount, commitment_mask.key_id)
.with_features(OutputFeatures::new(
OutputFeaturesVersion::get_current_version(),
Expand Down
19 changes: 10 additions & 9 deletions base_layer/wallet/src/output_manager_service/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1213,15 +1213,16 @@ where
)));
}
// Retrieve the list of n public keys from the script
let public_keys =
if let Some(Opcode::CheckMultiSigVerifyAggregatePubKey(_n, _m, keys, _msg)) = output.script.as_slice().get(1) {
keys.clone()
} else {
return Err(OutputManagerError::ServiceError(format!(
"Invalid script (TxId: {})",
tx_id
)));
};
let public_keys = if let Some(Opcode::CheckMultiSigVerifyAggregatePubKey(_n, _m, keys, _msg)) =
output.script.as_slice().get(3)
{
keys.clone()
} else {
return Err(OutputManagerError::ServiceError(format!(
"Invalid script (TxId: {})",
tx_id
)));
};
// Create a deterministic encryption key from the sum of the public keys
let sum_public_keys = public_keys
.iter()
Expand Down

0 comments on commit 51eb8c4

Please sign in to comment.