@@ -165,7 +165,7 @@ check_schemata_version() {
165
165
166
166
check_tools () {
167
167
_subtit " checking required tools"
168
- local required_tools=" base64 cargo cut docker grep head jq sha256sum"
168
+ local required_tools=" base64 cargo cut docker grep head jq nc sha256sum tr "
169
169
for tool in $required_tools ; do
170
170
if ! which " $tool " > /dev/null; then
171
171
_die " could not find reruired tool \" $tool \" , please install it and try again"
@@ -305,12 +305,8 @@ start_services() {
305
305
_subtit " stopping services"
306
306
docker compose down
307
307
_subtit " checking bound ports"
308
- if ! which ss > /dev/null; then
309
- _log " ss not available, skipping bound ports check"
310
- return
311
- fi
312
308
# see docker-compose.yml for the exposed ports
313
- if [ -n " $( ss -HOlnt ' sport = : 50001' ) " ] ; then
309
+ if nc -z localhost 50001; then
314
310
_die " port 50001 is already bound, electrs service can't start"
315
311
fi
316
312
_subtit " starting services"
@@ -439,7 +435,7 @@ transfer_create() {
439
435
440
436
# # extract PSBT data
441
437
local decoded_psbt
442
- decoded_psbt=" $( _trace " ${BCLI[@]} " decodepsbt " $( base64 -w0 " $send_data /$PSBT " ) " ) "
438
+ decoded_psbt=" $( _trace " ${BCLI[@]} " decodepsbt " $( base64_file_nowrap " $send_data /$PSBT " ) " ) "
443
439
if [ $DEBUG = 1 ]; then
444
440
_log " showing PSBT including RGB transfer data"
445
441
echo " $decoded_psbt " | jq
@@ -478,9 +474,10 @@ transfer_complete() {
478
474
local der_xprv der_xpub psbt_finalized psbt_signed
479
475
der_xprv=${DER_XPRV_MAP[$SEND_WLT]}
480
476
der_xpub=${DER_XPUB_MAP[$SEND_WLT]}
477
+
481
478
psbt_signed=$( _trace " $BDKI " -n $NETWORK wallet -w " $SEND_WLT " \
482
479
-d " ${DESC_TYPE} ($der_xprv )" sign \
483
- --psbt " $( base64 -w0 " $send_data /$PSBT " ) " )
480
+ --psbt " $( base64_file_nowrap " $send_data /$PSBT " ) " )
484
481
psbt_finalized=$( echo " $psbt_signed " \
485
482
| jq -r ' select(.is_finalized = true) |.psbt' )
486
483
[ -n " $psbt_finalized " ] || _die " error signing or finalizing PSBT"
@@ -525,6 +522,15 @@ help() {
525
522
echo " -v --verbose enable verbose output"
526
523
}
527
524
525
+ base64_file_nowrap () {
526
+ # This function encodes the specified file to base64 format without wrapping lines.
527
+ # By default, Linux systems wrap base64 output every 76 columns. We use 'tr -d' to remove whitespaces.
528
+ # Note that the option '-w0' for 'base64' doesn't work on Mac OS X due to different flags.
529
+ # Arguments:
530
+ # $1: File path to be encoded
531
+ cat " $1 " | base64 | tr -d ' \r\n'
532
+ }
533
+
528
534
529
535
# cmdline arguments
530
536
while [ -n " $1 " ]; do
0 commit comments