Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

Multisig bundle validation fails when digests generated with security_level < 3 #276

@woywoy123

Description

@woywoy123
#User 1
api_1 = MultisigIota(adapter=Node,seed=Seed(u1), local_pow = True)
gd_result = api_1.get_digests(index=1,count=1, security_level=2)
digest_1 = gd_result['digests'][0]  # type: Digest

#User 2
api_2 = MultisigIota(adapter=Node,seed=Seed(u2), local_pow = True)
gd_result = api_2.get_digests(index=3, count=1, security_level=1)
digest_2 = gd_result['digests'][0]

#User 3
api_3 = MultisigIota(adapter=Node,seed=Seed(u3), local_pow = True)
gd_result = api_3.get_digests(index=3, count=1, security_level=1)
digest_3 = gd_result['digests'][0]

#Creating the multisig address
cma_result = api_1.create_multisig_address(digests=[digest_2, digest_3])
multisig_address = cma_result['address']  # type: MultisigAddress
print(multisig_address.with_valid_checksum())


#Proposing the multisignature 
pmt_result = api_2.prepare_multisig_transfer(transfers=[ProposedTransaction(address=Address(Receiver),value=1)], multisig_input=multisig_address, change_address=Receiver)
prepared_trytes = pmt_result['trytes']
bundle = Bundle.from_tryte_strings(prepared_trytes)

gpk_result = api_2.get_private_keys(index=3, count=1, security_level=1)
private_key_2 = gpk_result['keys'][0]  # type: PrivateKey
private_key_2.sign_input_transactions(bundle, 1)

gpk_result = api_3.get_private_keys(index=3, count=1, security_level=1)
private_key_3 = gpk_result['keys'][0]  # type: PrivateKey
private_key_3.sign_input_transactions(bundle, 2)

signed_trytes = bundle.as_tryte_strings()

validator = BundleValidator(bundle)
if not validator.is_valid():
    print("Failed")

The code above is a slight modification of [1], when you set the security levels and the digests exactly like in [1] this code will work. But when you generate a multisignature address from only 2 digests with security level 1 on each this wont work. Anyone come across this issue?

[1]. https://github.com/iotaledger/iota.py/blob/develop/examples/multisig.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions