diff --git a/.github/actions/install-sim/action.yml b/.github/actions/install-sim/action.yml index abfbded13..443a0b74e 100644 --- a/.github/actions/install-sim/action.yml +++ b/.github/actions/install-sim/action.yml @@ -27,7 +27,6 @@ runs: git config --global user.name "ci" pushd test/work; git clone --recursive https://github.com/Coldcard/firmware.git; popd tar -xvf coldcard-mpy.tar.gz - pushd test/work/firmware; git am ../../data/coldcard-multisig.patch; popd poetry run pip install -r test/work/firmware/requirements.txt pip install -r test/work/firmware/requirements.txt diff --git a/ci/cirrus.Dockerfile b/ci/cirrus.Dockerfile index 17d6752d8..77a7b1f24 100644 --- a/ci/cirrus.Dockerfile +++ b/ci/cirrus.Dockerfile @@ -74,7 +74,6 @@ RUN protoc --version ## Set up environments first to take advantage of layer caching #RUN mkdir test #COPY test/setup_environment.sh test/setup_environment.sh -#COPY test/data/coldcard-multisig.patch test/data/coldcard-multisig.patch ## One by one to allow for intermediate caching of successful builds #RUN cd test; ./setup_environment.sh --trezor-1 #RUN cd test; ./setup_environment.sh --trezor-t diff --git a/hwilib/devices/coldcard.py b/hwilib/devices/coldcard.py index e64f3619c..05384415d 100644 --- a/hwilib/devices/coldcard.py +++ b/hwilib/devices/coldcard.py @@ -132,14 +132,23 @@ def sign_tx(self, tx: PSBT) -> PSBT: # For multisigs, we may need to do multiple passes if we appear in an input multiple times passes = 1 - for psbt_in in tx.inputs: - our_keys = 0 - for key in psbt_in.hd_keypaths.keys(): - keypath = psbt_in.hd_keypaths[key] - if keypath.fingerprint == master_fp and key not in psbt_in.partial_sigs: - our_keys += 1 - if our_keys > passes: - passes = our_keys + + ver = None + try: + ver = self.device.send_recv(CCProtocolPacker.version()) + except: pass + if not ver or ("X" not in ver.split("\n")[1]): + # is not EDGE firmware, to sign multiple keys + # from same origin, signing must be repeated + # EDGE can sign all in one sitting + for psbt_in in tx.inputs: + our_keys = 0 + for key in psbt_in.hd_keypaths.keys(): + keypath = psbt_in.hd_keypaths[key] + if keypath.fingerprint == master_fp and key not in psbt_in.partial_sigs: + our_keys += 1 + if our_keys > passes: + passes = our_keys for _ in range(passes): # Get psbt in hex and then make binary diff --git a/test/setup_environment.sh b/test/setup_environment.sh index cb4600fe8..89e2874bc 100755 --- a/test/setup_environment.sh +++ b/test/setup_environment.sh @@ -148,8 +148,6 @@ if [[ -n ${build_coldcard} ]]; then coldcard_setup_needed=true fi fi - # Apply patch to make simulator work in linux environments - git am ../../data/coldcard-multisig.patch # Build the simulator. This is cached, but it is also fast poetry run pip install -r requirements.txt