mirror of
https://github.com/basicswap/basicswap.git
synced 2025-01-18 16:44:34 +00:00
Sum keys in libsecp256k1
This commit is contained in:
parent
5e5bf31156
commit
c180f34f66
2 changed files with 11 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2020 tecnovert
|
||||
# Copyright (c) 2020-2021 tecnovert
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -11,7 +11,10 @@ import logging
|
|||
import basicswap.contrib.ed25519_fast as edf
|
||||
import basicswap.ed25519_fast_util as edu
|
||||
import basicswap.util_xmr as xmr_util
|
||||
from coincurve.ed25519 import ed25519_get_pubkey
|
||||
from coincurve.ed25519 import (
|
||||
ed25519_get_pubkey,
|
||||
ed25519_scalar_add,
|
||||
ed25519_add)
|
||||
from coincurve.keys import PrivateKey
|
||||
from coincurve.dleag import (
|
||||
verify_ed25519_point,
|
||||
|
@ -191,12 +194,10 @@ class XMRInterface(CoinInterface):
|
|||
return i
|
||||
|
||||
def sumKeys(self, ka, kb):
|
||||
return i2b((b2i(ka) + b2i(kb)) % edf.l)
|
||||
return ed25519_scalar_add(ka, kb)
|
||||
|
||||
def sumPubkeys(self, Ka, Kb):
|
||||
Ka_d = edf.decodepoint(Ka)
|
||||
Kb_d = edf.decodepoint(Kb)
|
||||
return self.encodePubkey(edf.edwards_add(Ka_d, Kb_d))
|
||||
return ed25519_add(Ka, Kb)
|
||||
|
||||
def publishBLockTx(self, Kbv, Kbs, output_amount, feerate):
|
||||
self.rpc_wallet_cb('open_wallet', {'filename': self._wallet_filename})
|
||||
|
|
|
@ -69,6 +69,8 @@ BASE_PART_RPC_PORT = 19792
|
|||
BASE_BTC_RPC_PORT = 19796
|
||||
|
||||
NUM_NODES = 3
|
||||
EXTRA_CONFIG_JSON = json.loads(os.getenv('EXTRA_CONFIG_JSON', '{}'))
|
||||
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.level = logging.DEBUG
|
||||
|
@ -176,6 +178,8 @@ class Test(unittest.TestCase):
|
|||
for ip in range(NUM_NODES):
|
||||
if ip != i:
|
||||
fp.write('connect=127.0.0.1:{}\n'.format(BITCOIN_PORT_BASE + ip + PORT_OFS))
|
||||
for opt in EXTRA_CONFIG_JSON.get('btc{}'.format(i), []):
|
||||
fp.write(opt + '\n')
|
||||
|
||||
with open(os.path.join(client_path, 'monero', 'monerod.conf'), 'a') as fp:
|
||||
fp.write('p2p-bind-ip=127.0.0.1\n')
|
||||
|
|
Loading…
Reference in a new issue