Remove the ringsize parameter

This commit is contained in:
Michał Sałaban 2018-10-19 01:32:04 +02:00
parent 91c720ecee
commit 9d03995092
5 changed files with 6 additions and 65 deletions

View File

@ -24,14 +24,6 @@ class Account(object):
self.incoming = PaymentManager(index, backend, 'in')
self.outgoing = PaymentManager(index, backend, 'out')
def _check_ringsize(self, ringsize):
if ringsize != 11:
warnings.warn("Requested ring size {rs}. Since protocol v8 hard fork "
"(monero-0.13) the ring size is fixed to 11 (mixin size 10). The ringsize "
"argument will be dropped in version 0.5. Please update accordingly.".format(
rs=ringsize),
DeprecationWarning)
def balances(self):
"""
Returns a tuple of balance and unlocked balance.
@ -74,7 +66,7 @@ class Account(object):
return self._backend.new_address(account=self.index, label=label)
def transfer(self, address, amount,
priority=prio.NORMAL, ringsize=11, payment_id=None, unlock_time=0,
priority=prio.NORMAL, payment_id=None, unlock_time=0,
relay=True):
"""
Sends a transfer. Returns a list of resulting transactions.
@ -84,7 +76,6 @@ class Account(object):
:param priority: transaction priority, implies fee. The priority can be a number
from 1 to 4 (unimportant, normal, elevated, priority) or a constant
from `monero.prio`.
:param ringsize: the ring size (deprecated, will be gone in v0.5)
:param payment_id: ID for the payment (must be None if
:class:`IntegratedAddress <monero.address.IntegratedAddress>`
is used as the destination)
@ -94,18 +85,16 @@ class Account(object):
so they might be broadcasted later
:rtype: list of :class:`Transaction <monero.transaction.Transaction>`
"""
self._check_ringsize(ringsize)
return self._backend.transfer(
[(address, amount)],
priority,
ringsize,
payment_id,
unlock_time,
account=self.index,
relay=relay)
def transfer_multiple(self, destinations,
priority=prio.NORMAL, ringsize=11, payment_id=None, unlock_time=0,
priority=prio.NORMAL, payment_id=None, unlock_time=0,
relay=True):
"""
Sends a batch of transfers. Returns a list of resulting transactions.
@ -115,7 +104,6 @@ class Account(object):
:param priority: transaction priority, implies fee. The priority can be a number
from 1 to 4 (unimportant, normal, elevated, priority) or a constant
from `monero.prio`.
:param ringsize: the ring size (deprecated, will be gone in v0.5)
:param payment_id: ID for the payment (must be None if
:class:`IntegratedAddress <monero.address.IntegratedAddress>`
is used as the destination)
@ -125,11 +113,9 @@ class Account(object):
so they might be broadcasted later
:rtype: list of :class:`Transaction <monero.transaction.Transaction>`
"""
self._check_ringsize(ringsize)
return self._backend.transfer(
destinations,
priority,
ringsize,
payment_id,
unlock_time,
account=self.index,

View File

@ -287,7 +287,7 @@ class JSONRPCWallet(object):
{'signed_key_images': key_images})
return (_data['height'], from_atomic(_data['spent']), from_atomic(_data['unspent']))
def transfer(self, destinations, priority, ringsize,
def transfer(self, destinations, priority,
payment_id=None, unlock_time=0, account=0,
relay=True):
data = {
@ -295,7 +295,6 @@ class JSONRPCWallet(object):
'destinations': list(map(
lambda dst: {'address': str(address(dst[0])), 'amount': to_atomic(dst[1])},
destinations)),
'mixin': ringsize - 1,
'priority': priority,
'unlock_time': 0,
'get_tx_keys': True,

View File

@ -182,7 +182,7 @@ class Wallet(object):
return self.accounts[0].new_address(label=label)
def transfer(self, address, amount,
priority=prio.NORMAL, ringsize=11, payment_id=None, unlock_time=0,
priority=prio.NORMAL, payment_id=None, unlock_time=0,
relay=True):
"""
Sends a transfer from the default account. Returns a list of resulting transactions.
@ -192,7 +192,6 @@ class Wallet(object):
:param priority: transaction priority, implies fee. The priority can be a number
from 1 to 4 (unimportant, normal, elevated, priority) or a constant
from `monero.prio`.
:param ringsize: the ring size (deprecated, will be gone in v0.5)
:param payment_id: ID for the payment (must be None if
:class:`IntegratedAddress <monero.address.IntegratedAddress>`
is used as the destination)
@ -206,13 +205,12 @@ class Wallet(object):
address,
amount,
priority=priority,
ringsize=ringsize,
payment_id=payment_id,
unlock_time=unlock_time,
relay=relay)
def transfer_multiple(self, destinations,
priority=prio.NORMAL, ringsize=11, payment_id=None, unlock_time=0,
priority=prio.NORMAL, payment_id=None, unlock_time=0,
relay=True):
"""
Sends a batch of transfers from the default account. Returns a list of resulting
@ -222,7 +220,6 @@ class Wallet(object):
:param priority: transaction priority, implies fee. The priority can be a number
from 1 to 4 (unimportant, normal, elevated, priority) or a constant
from `monero.prio`.
:param ringsize: the ring size (deprecated, will be gone in v0.5)
:param payment_id: ID for the payment (must be None if
:class:`IntegratedAddress <monero.address.IntegratedAddress>`
is used as a destination)
@ -235,7 +232,6 @@ class Wallet(object):
return self.accounts[0].transfer_multiple(
destinations,
priority=priority,
ringsize=ringsize,
payment_id=payment_id,
unlock_time=unlock_time,
relay=relay)

View File

@ -965,45 +965,6 @@ class SubaddrWalletTestCase(unittest.TestCase):
'tx_blob_list': ['020001020005a3d60be09109dfd202e617d904090789e33b02c001885d17d80101a4de34b9e76f8e9b87f50766b33a1f00f49d020002c5fc19a94f82a9cefeaebf5f9f7d8330ff28cc7b1c6dba65d5dd3bfe4693056a00028711ea3e11b97250e7563838e4ea203594c4b33784c2d9777aa738061a31946d2c020901b259965ad1f33d2d014c8cdd4a341a75cf01fef00e6b344b47150e55ae06333b5585b20eb0f4afff160380fde0b30ee3c5ebbb3bbaf11b30f4ef79ee96122175077cec9866b88aa123fdd9f55e2d06cb3815f7e8e88dbcd4f6776aafd13cdf21c86b38671bb4641dd4d696fff29a0546817024cb9f9330fe86a43c1e4088a9019a601aa80025e3f24d0ab5066fdd09254ec751d101960c3422db7657a43b764f015679b3da7221aa349d40ddcce60964af135cbef245c4a2d51bd2b8605b6ce7576f32e9f0b06d91b3840828902cd4c35a1a59fdef21441a02a78229df304f8569f259c3ec218ffe45722020fbfde6a74b0d36753d6afae377e771d454839f8e76762e23dbf35ee354716f7d15f42e7e03048d917984a814fdef3ea4556d0946b30a790e8e0739e8e9f933da61e3ddd2699df0bcf55ac1c149cfbea618830933830bd3937b1f27613cd0959b6020dda7ced635d3c41d31694a526788a7c783e8476594006e2dee7d9fd606d793618fc062ed8cc178c4e1376524a6029a618b882cbfc86f40cc0a036b11d30500290abc052823a5f3b180cb7e05e0c9316a7cbfc9e94c370e0817b3ad5c90c0d9070606883d72d6706f1b5069652a8a98c20d60774ff6dd3ba2fa09d39af8c5f7cca2e592cdd0df79482d44baba5531f24961967c43c720aa8f3d93b376c67064960baacf4c347dc243cee2b44e8194fe14e1efe785924671cf8ff3bf545ab8a05213bcce3adef4dae1988e9d33926722be5927c952f6b8f36e62a8fafdb699c8ffdc61720a6d869bfc2719a05fe9f13c72e295869955bfb88eb79d95d19285340049906d497d9d847c09b7e4009d8b0c09a535e993583270227e00c883822a32fbf1c206e5de38438c1d637fd87600f6d56b673e608625acfebbfb8c32632da3282346588078d4af03c84ef78a141af8ca92d236b7f464aad3f4e66e34689d0bb2fbed1a0b9fc342e5e8a51505b69c9cb7d401778576e36c68475ad738e35f867ad6498428d59fdf3e92d42cb91515675a0a8412a85e359c4aa9f25a684b2e5fa0d3faee9afef115113579b423f2386edf9b8961c1a37967a7718b20594421fdb537069c643f03475f2396ad61faa904c1f35ce2436f6260c51c429a58358c1f19961bb8a9b3516e2eef13551315ab586e68caae69c4c09b40ff6fff4f67fdc2f700600b5a97f280b6a94c11068065d8edf1cbb10203e559ee94ba3cbea4eee1cd36790012196284ba15b3d7427c3fd3647cb65c9230d2fafbd96c978e0545e404317805c549d2bfcb7bc68bdbce5a94f2f090487d58e2be4d011b44532d8543338c64cf91dc869021b94b5c2b7dabf666b2a57c703e4a1cbd6702fceb42cff1108e06b4412abbc5f68cae62fc01bd9ac96e36ce07d1536115d44c752b37d5d90ea44614a76a67ac7da251511a8fed42a012478f29031603da3eef2cde3d7a9e342c92fcc88f1437a50ec0bb18670ece373de05945dd05976433a32bf352715fe5c8960940a9cff86b97bf57786ccfbf7ddac06bb657ed936d6c112bdc6bf6e5f731ef0e066f554b95f530932ac950ebddd01eb04bf36073da30bf1addf137a0f5852fa8480dfc7e2962424c5d3d6f420f85217d30b481dae95db7d87d8da86cc259675b33a546c0eff502768ea78a296ca55b608dd492c2c213415c45b3167c051f45fc04c12c67a06d984f8deef6079dcd0f6d07513c735630d53ff281d9a2024e84f749164db0fe0826690c460342b5c48a4fb2f7cae80efef65cea5b733bf8624314e74efd5212c23925ab08adaa5bd78bfb24bc5e4133328e478235a42538c0d01edb065ff17ed0116d1e33864dbedc31304c04d31ae7451048979c9ca4e92d6bcdb5e4ac42caa22665729967504dd1242f95f71dcbc59cd9d62c831f774ac9ebe0619318f31229075535793924dc79874fff17954686c4463b1094d1e3f8a98c115fec2d2b1e37c11d06f7a24c1dbf7871b7510d8f5785b47a5c62203820add67f0264dfe71ac6185e457d3be8944ba5ff3d78847b21349a2a5813b79fadce4fa2f393edaa4904c7564d8036664b0191090e82bf275b552e8cd5f04ee30511a8edad21bb8041588e71296836d34e86e8f7c6edc4327b7d1122377b19fb6e8961c26a0ab1b4e3a5e0f6d2b6b4448e395985981584c78da0b7678d2a338d553d07be430c0e967c86e0859eb69422959d6eacb43ed9acc678d515466ce9bca08c03ad2a09affa136893566df52a553ca67f529fe9fa72f15b7fd60c769a5168d53c02d701937d20d79284f34e1b7094c40491df2619c03efacc3989d340d7b611c348f9098fa80e007874cd7bdb6eb67c23e17f8446ca01b6ea1fe1475b3cb5a031d50e0424f2efb010259a038d693ca1ab3bc1abf5c56880c2d14355790934617c2b260a74883c88310fa0bb0d2aa0a5778532b3bff7a80586a2fd761e2620c3bcad1006cc328cdd3a9c790d30d260e473a85ffc8200dae9bc2992cd446d55103668db0e2f85976ec87bf7bda26c4c6492f76e493beef5daf29f0b723fa8d9cb4eba4f03396c65b052fbf4521dfd7ed611fe3bbbb577ab46ff87002bad166e6a61873b0e2a8b5be203a6a0c4bd12c7a5cc82284d12b089b4cf245d38d93749383a85b202deba9fbcab44b9f343117669ccf91cf16df5af4309941c718e937228ec2ace05c3fbf708be2d079c92b1045c0167116dc2c52323b23f8514eddbe1e3d30cb005'],
'tx_hash_list': ['401d8021975a0fee16fe84acbfc4d8ba6312e563fa245baba2aac382e787fb60'],
'tx_key_list': ['7061d4d939b563a11e344c60938410e2e63ea72c43741fae81b8805cebe5570a']}}
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
self.wallet.transfer(
'9wFuzNoQDck1pnS9ZhG47kDdLD1BUszSbWpGfWcSRy9m6Npq9NoHWd141KvGag8hu2gajEwzRXJ4iJwmxruv9ofc2CwnYCE',
3,
ringsize=10)
self.assertEqual(len(w), 1)
self.assertIs(w[0].category, DeprecationWarning)
self.wallet.transfer(
'9wFuzNoQDck1pnS9ZhG47kDdLD1BUszSbWpGfWcSRy9m6Npq9NoHWd141KvGag8hu2gajEwzRXJ4iJwmxruv9ofc2CwnYCE',
3,
ringsize=12)
self.assertEqual(len(w), 2)
self.assertIs(w[1].category, DeprecationWarning)
self.wallet.transfer(
'9wFuzNoQDck1pnS9ZhG47kDdLD1BUszSbWpGfWcSRy9m6Npq9NoHWd141KvGag8hu2gajEwzRXJ4iJwmxruv9ofc2CwnYCE',
3,
ringsize=11)
self.assertEqual(len(w), 2)
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
self.wallet.transfer_multiple(
[('9wFuzNoQDck1pnS9ZhG47kDdLD1BUszSbWpGfWcSRy9m6Npq9NoHWd141KvGag8hu2gajEwzRXJ4iJwmxruv9ofc2CwnYCE',
3)],
ringsize=10)
self.assertEqual(len(w), 1)
self.assertIs(w[0].category, DeprecationWarning)
self.wallet.transfer_multiple(
[('9wFuzNoQDck1pnS9ZhG47kDdLD1BUszSbWpGfWcSRy9m6Npq9NoHWd141KvGag8hu2gajEwzRXJ4iJwmxruv9ofc2CwnYCE',
3)],
ringsize=12)
self.assertEqual(len(w), 2)
self.assertIs(w[1].category, DeprecationWarning)
self.wallet.transfer_multiple(
[('9wFuzNoQDck1pnS9ZhG47kDdLD1BUszSbWpGfWcSRy9m6Npq9NoHWd141KvGag8hu2gajEwzRXJ4iJwmxruv9ofc2CwnYCE',
3)],
ringsize=11)
self.assertEqual(len(w), 2)
@patch('monero.backends.jsonrpc.requests.post')
def test_export_import_outputs(self, mock_post):

View File

@ -32,7 +32,6 @@ argsparser.add_argument('-a', dest='account', default=0, type=int, help="Source
argsparser.add_argument('-p', dest='prio',
choices=['unimportant', 'normal', 'elevated', 'priority'],
default='normal')
argsparser.add_argument('-r', dest='ring_size', type=int, default=5, help="Ring size")
argsparser.add_argument('-i', dest='payment_id', nargs='?', type=PaymentID,
const=PaymentID(random.randint(0, 2**256)),
help="Payment ID")
@ -53,7 +52,7 @@ logging.basicConfig(level=level, format="%(asctime)-15s %(message)s")
w = Wallet(JSONRPCWallet(**args.wallet_rpc_url))
txns = w.accounts[args.account].transfer_multiple(
args.destinations, priority=prio, ringsize=args.ring_size, payment_id=args.payment_id,
args.destinations, priority=prio, payment_id=args.payment_id,
relay=args.outdir is None)
for tx in txns:
print(u"Transaction {hash}:\nfee: {fee:21.12f}\n"