Browse Source

Fixes #305

Previous to this commit, a user could create a direct payment or
Joinmarket coinjoin inadvertently by not using the correct arguments
to sendpayment.py (missing -T or setting -N0). After this commit,
the correct number of arguments (3) are insisted on, and -T takes
precedence over -N 0.
master
AdamISZ 7 years ago
parent
commit
fd5e6d8d8b
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 14
      scripts/sendpayment.py

14
scripts/sendpayment.py

@ -51,8 +51,13 @@ def main():
parser = get_sendpayment_parser()
(options, args) = parser.parse_args()
load_program_config()
if options.schedule == '' and len(args) < 3:
parser.error('Needs a wallet, amount and destination address')
if options.p2ep and len(args) != 3:
parser.error("PayJoin requires exactly three arguments: "
"wallet, amount and destination address.")
sys.exit(0)
elif options.schedule == '' and len(args) != 3:
parser.error("Joinmarket sendpayment (coinjoin) needs arguments:"
" wallet, amount and destination address")
sys.exit(0)
#without schedule file option, use the arguments to create a schedule
@ -73,6 +78,9 @@ def main():
schedule = [[options.mixdepth, amount, options.makercount,
destaddr, 0.0, 0]]
else:
if options.p2ep:
parser.error("Schedule files are not compatible with PayJoin")
sys.exit(0)
result, schedule = get_schedule(options.schedule)
if not result:
log.error("Failed to load schedule file, quitting. Check the syntax.")
@ -126,7 +134,7 @@ def main():
#wallet sync will now only occur on reactor start if we're joining.
while not jm_single().bc_interface.wallet_synced:
sync_wallet(wallet, fast=options.fastsync)
if options.makercount == 0:
if options.makercount == 0 and not options.p2ep:
direct_send(wallet, amount, mixdepth, destaddr, options.answeryes)
return

Loading…
Cancel
Save