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