Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

funding asset err with ob-lnd #3

Closed
wxf4150 opened this issue May 31, 2022 · 16 comments · Fixed by #2
Closed

funding asset err with ob-lnd #3

wxf4150 opened this issue May 31, 2022 · 16 comments · Fixed by #2
Assignees
Labels
bug Something isn't working

Comments

@wxf4150
Copy link
Collaborator

wxf4150 commented May 31, 2022

#startup node-a and node-b:
bash docker/lnd/start-a.sh
bash docker/lnd/start-b.sh


a-cli.sh getinfo
{
    "version": "0.14.2-beta commit=v0.14.2-beta-21-gfecc8df7d-dirty",
    "commit_hash": "fecc8df7d6fbd2d6a66524ce73fa56f50c1bc40a",
    "identity_pubkey": "02b4c20d120cb326f42887007548f1628ef03df5a16d0c1a9189ba546fb888c520",
    ......   
}

 
a-cli.sh newaddress np2wkh
{
    "address": "2N8uoiw2g6Y3hG1dFwBtWLZZbCCWZt6MonR"
}

recharge 2N8uoiw2g6Y3hG1dFwBtWLZZbCCWZt6MonR with Faucet for btc and asset
Faucet:

b-cli.sh connect 02b4c20d120cb326f42887007548f1628ef03df5a16d0c1a9189ba546fb888c520@localhost:9736


a-cli.sh openchannel --asset_id 137 --node_key 03f3fbd0438d39f07157977b31a10e4fd9d63ca3d960f2c7c88ac1424181765940 --local_btc_amt=90000 --local_asset_amt=90 
{
        "funding_txid": "de6159b4f5ae2e755e15f695a1631ac8d16729a20683c62c7beec44aeda06d33"
}

some err from node-a log :
2022-05-31 17:45:35.923 [ERR] FNDG: Unable to broadcast funding tx 020000000001034d2b60bd2ff29f0ced565ee638aa1033cfe1c0d1cb372d5053f6e23339129624020000001716001459ece1873003e0f988aa08f54997f9e163eea012000000002e673d2fc8600fdfe54a5b1dcd6d432e024b51f82ae124ce25f4d34c97ba4dc50100000017160014663677ab544fa717b271c528b018ebe6ec0a107e000000004c2c9edf33ad2ce2d481d944aefffbedb9cb9661471877d26b402586dc1ecee90100000017160014663677ab544fa717b271c528b018ebe6ec0a107e000000000300000000000000001200000007000000890102000000000000005ade29000000000000160014410370e7d142feda2b443b288b3b1606fc06feea905f010000000000220020751f31da1a25ce1bfbaffdfa86126c968404645ed3c203330f50b04dd22092170247304402203157c7e6a7a29a6ffcd9ec8b7cf27977a4a7a2b1daa1ee8465c1fefa1d788fce0220187a5eea6a34d36f229b3fd60ebcd131da4c3ba98c4cffdc90f42b1a2ce97bb0012102df25495d5ae5bb7d8deb845bf3c7828e5f18d8deba2a3c40faab93a0b86e808e0247304402201dbe0f777a6479aa92f74d18c571b9ee73eeaa2e1485131bb6ea0a1c5f3ad5e80220361ca20af807835b3d941a4c6f0409bb578fdb346c78fd2891f8fd0392b0854f012102cf238281a64299b1ca243e87ee4f13b20f5edf001288e8bc891c645cce1c78ba024830450221009ebc609bd77febe2aca30b8b7324ad4c52c2e15bac5f95c5b14bb68cab51434702201fcaa9253ab1f39b3dec14e5a79d05bce91627d4da7622b82beec6018b4beaa7012102cf238281a64299b1ca243e87ee4f13b20f5edf001288e8bc891c645cce1c78ba00000000 for ChannelPoint(de6159b4f5ae2e755e15f695a1631ac8d16729a20683c62c7beec44aeda06d33:2): unmatched backend error: -26: min relay fee not met, 362 < 384

cat docker/lnd/b-cli.sh
./lncli-debug --rpcserver=localhost:10009 --lnddir=~/apps/oblnd-dev -n testnet "$@"

cat docker/lnd/a-cli.sh
./lncli-debug --rpcserver=localhost:10010 --lnddir=~/apps/oblnd -n testnet "$@"

@wxf4150
Copy link
Collaborator Author

wxf4150 commented May 31, 2022

maybe funding tx gas fee err .

@neocarmack neocarmack self-assigned this Jun 2, 2022
@neocarmack neocarmack added the bug Something isn't working label Jun 2, 2022
@neocarmack neocarmack linked a pull request Jun 2, 2022 that will close this issue
Merged
@neocarmack
Copy link
Member

The new omnicore in the following PR only supports Regtest mode. Faucet for testnet will cause error.

OmniLayer/omnicore#1252

@wxf4150
Copy link
Collaborator Author

wxf4150 commented Jun 2, 2022

the err: "unmatched backend error: -26: min relay fee not met, 362 < 384" has fixed at commit 28d5346

but now when call openchannel, the new err msg "unmatched backend error: -26: scriptpubkey" , i have no idea.
2022-06-02 18:04:51.501 [ERR] FNDG: Unable to broadcast funding tx 020000000001027c53c5db5d9e4bf99f933894707adeb1e27bc945eef9bfd2ab6fb067b6372e320100000017160014b77c9d0e4ee79143cf094f20cc448180e10fd6bf00000000723bef4b378383f65a1369fec03e0255b669cc417660105177d76e791a1d8fe20100000017160014b77c9d0e4ee79143cf094f20cc448180e10fd6bf000000000300000000000000001200000007800000050101000000001dcd6500905f0100000000002200205f5bfbfe5fc06b7620661b92823b31ab9b84dec5f96f884295b6818729cf8e6b8a49f405000000001600141f675d44c10a9f31219d553a622f4280d06340cf0247304402206ef730326721834f7356ef4ea76ff6ab67c9a654cc819866aa7ff7b2b1803bfb02207f682743f65b3791724ca195b276a702f69802a5dfddc413b05a47edfbdafacc012102fa828ec13d8bb6c75913df5a833db68e6705d3b462c441d5d132a062ea41719a024730440220532504b057f27c0b1f968dc5a2c6a1f5ec81a578a5c7889b4946cedefb99fa85022066cb4374f1b9a34335b8d9fec8f6b1e3ffa218736abdb249af6439d97dcdeb68012102fa828ec13d8bb6c75913df5a833db68e6705d3b462c441d5d132a062ea41719a00000000 for ChannelPoint(561e97fec7c818a068dd9e6f2f84055127a133fceb95313c70cb3b7c05c6e794:1): unmatched backend error: -26: scriptpubkey

@wxf4150
Copy link
Collaborator Author

wxf4150 commented Jun 2, 2022

this is the funding-tx dump in the log

2022-06-02 18:04:51.501 [INF] LNWL: Removed invalid transaction: (*wire.MsgTx)(0xc000147ec0)({
 Version: (int32) 2,
 TxIn: ([]*wire.TxIn) (len=2 cap=15) {
  (*wire.TxIn)(0xc00229aea0)({
   PreviousOutPoint: (wire.OutPoint) 322e37b667b06fabd2bff9ee45c97be2b1de7a709438939ff94b9e5ddbc5537c:1,
   SignatureScript: ([]uint8) (len=23 cap=500) {
    00000000  16 00 14 b7 7c 9d 0e 4e  e7 91 43 cf 09 4f 20 cc  |....|..N..C..O .|
    00000010  44 81 80 e1 0f d6 bf                              |D......|
   },
   Witness: (wire.TxWitness) (len=2 cap=2) {
    ([]uint8) (len=71 cap=144) {
     00000000  30 44 02 20 6e f7 30 32  67 21 83 4f 73 56 ef 4e  |0D. n.02g!.OsV.N|
     00000010  a7 6f f6 ab 67 c9 a6 54  cc 81 98 66 aa 7f f7 b2  |.o..g..T...f....|
     00000020  b1 80 3b fb 02 20 7f 68  27 43 f6 5b 37 91 72 4c  |..;.. .h'C.[7.rL|
     00000030  a1 95 b2 76 a7 02 f6 98  02 a5 df dd c4 13 b0 5a  |...v...........Z|
     00000040  47 ed fb da fa cc 01                              |G......|
    },
    ([]uint8) (len=33 cap=33) {
     00000000  02 fa 82 8e c1 3d 8b b6  c7 59 13 df 5a 83 3d b6  |.....=...Y..Z.=.|
     00000010  8e 67 05 d3 b4 62 c4 41  d5 d1 32 a0 62 ea 41 71  |.g...b.A..2.b.Aq|
     00000020  9a                                                |.|
    }
   },
   Sequence: (uint32) 0
  }),
  (*wire.TxIn)(0xc00229ae40)({
   PreviousOutPoint: (wire.OutPoint) e28f1d1a796ed7775110607641cc69b655023ec0fe69135af68383374bef3b72:1,
   SignatureScript: ([]uint8) (len=23 cap=500) {
    00000000  16 00 14 b7 7c 9d 0e 4e  e7 91 43 cf 09 4f 20 cc  |....|..N..C..O .|
    00000010  44 81 80 e1 0f d6 bf                              |D......|
   },
   Witness: (wire.TxWitness) (len=2 cap=2) {
    ([]uint8) (len=71 cap=144) {
     00000000  30 44 02 20 53 25 04 b0  57 f2 7c 0b 1f 96 8d c5  |0D. S%..W.|.....|
     00000010  a2 c6 a1 f5 ec 81 a5 78  a5 c7 88 9b 49 46 ce de  |.......x....IF..|
     00000020  fb 99 fa 85 02 20 66 cb  43 74 f1 b9 a3 43 35 b8  |..... f.Ct...C5.|
     00000030  d9 fe c8 f6 b1 e3 ff a2  18 73 6a bd b2 49 af 64  |.........sj..I.d|
     00000040  39 d9 7d cd eb 68 01                              |9.}..h.|
    },
    ([]uint8) (len=33 cap=33) {
     00000000  02 fa 82 8e c1 3d 8b b6  c7 59 13 df 5a 83 3d b6  |.....=...Y..Z.=.|
     00000010  8e 67 05 d3 b4 62 c4 41  d5 d1 32 a0 62 ea 41 71  |.g...b.A..2.b.Aq|
     00000020  9a                                                |.|
    }
   },
   Sequence: (uint32) 0
  })
 },
 TxOut: ([]*wire.TxOut) (len=3 cap=3) {
  (*wire.TxOut)(0xc001e3d7e0)({
   Value: (int64) 0,
   PkScript: ([]uint8) (len=18 cap=40) {
    00000000  00 00 00 07 80 00 00 05  01 01 00 00 00 00 1d cd  |................|
    00000010  65 00                                             |e.|
   }
  }),
  (*wire.TxOut)(0xc001e3d7a0)({
   Value: (int64) 90000,
   PkScript: ([]uint8) (len=34 cap=500) {
    00000000  00 20 5f 5b fb fe 5f c0  6b 76 20 66 1b 92 82 3b  |. _[.._.kv f...;|
    00000010  31 ab 9b 84 de c5 f9 6f  88 42 95 b6 81 87 29 cf  |1......o.B....).|
    00000020  8e 6b                                             |.k|
   }
  }),
  (*wire.TxOut)(0xc001e3cb80)({
   Value: (int64) 99895690,
   PkScript: ([]uint8) (len=22 cap=500) {
    00000000  00 14 1f 67 5d 44 c1 0a  9f 31 21 9d 55 3a 62 2f  |...g]D...1!.U:b/|
    00000010  42 80 d0 63 40 cf                                 |B..c@.|
   }
  })
 },
 LockTime: (uint32) 0
})


i have google the error msg "unmatched backend error: -26: scriptpubkey"

https://bitcointalk.org/index.php?topic=5307985.0

maybe the OP_RETURN_str in the length of TxOut[0].PkScript is too small.

@wxf4150
Copy link
Collaborator Author

wxf4150 commented Jun 2, 2022

TxOut[0].PkScript payload err ,
now . it's fixed at commit 23a064f .

the new err is :

2022-06-02T12:30:42Z parseTransaction(block=145, 2022-06-02T12:30:42Z idx= 1); txid: 6ed7872ca6dd4f589d905549b3f7b8d00d47efd348567dc49aaca6196f6e5015
2022-06-02T12:30:42Z 	------------------------------
2022-06-02T12:30:42Z 	         version: 0, class C
2022-06-02T12:30:42Z 	            type: 7 (Send To Many)
2022-06-02T12:30:42Z 	        property: 2147483653 (Test token: 5 : 0x80000005)
2022-06-02T12:30:42Z 	       receivers: 1
2022-06-02T12:30:42Z 	               output: 1
2022-06-02T12:30:42Z 	               value: 5.00000000
2022-06-02T12:30:42Z logicMath_SendToMany(): rejected: output 1 doesn't refer to valid destination
2022-06-02T12:30:42Z !!! interpretPacket() returned -86026 !!!
2022-06-02T12:30:42Z recordTX(6ed7872ca6dd4f589d905549b3f7b8d00d47efd348567dc49aaca6196f6e5015, valid=NO, block= 145, type= 7, value= 500000000)

the commit tx-hex

omnicore-cli decoderawtransaction  020000000001037c53c5db5d9e4bf99f933894707adeb1e27bc945eef9bfd2ab6fb067b6372e320100000017160014b77c9d0e4ee79143cf094f20cc448180e10fd6bf000000001731cae428108f98977d965f86c69312e69f2ec452e4485aa3ee1a68fe2ee5830100000017160014b77c9d0e4ee79143cf094f20cc448180e10fd6bf00000000723bef4b378383f65a1369fec03e0255b669cc417660105177d76e791a1d8fe20100000017160014b77c9d0e4ee79143cf094f20cc448180e10fd6bf00000000030000000000000000186a166f6d6e6900000007800000050101000000001dcd6500905f0100000000002200206cd61b832248cca6a64c237d26b3c966e6c684ca2aaf848e0d4e15e11635e425d439f40500000000160014dd0a40bbe3d4e3f86b74dcafc88e3689d72f052202483045022100c1b71e39b1ff67220346931f5e43f35685f132bcb7f07efd52629c5ff714e62a022070c1f579ade91b9bbbe19c3ca06c1e72909fdea5d413572f3ee09773f5d5e19a012102fa828ec13d8bb6c75913df5a833db68e6705d3b462c441d5d132a062ea41719a02473044022078b548f61b08a699f4908f7041212e67400510431cb1bf221cf06fb3859d6e7a022019fcb7fd3766be665f00624dcb6028919d73ac699cf9f76598705509ba6a0604012102fa828ec13d8bb6c75913df5a833db68e6705d3b462c441d5d132a062ea41719a0247304402201e7294104095176417e331e4201aaa3de4e028abd8356473a806dd16215dea5e0220206b42093aad2bdca5e8fb82470d1d4fd8e7ab1626325016c1126115764ccce7012102fa828ec13d8bb6c75913df5a833db68e6705d3b462c441d5d132a062ea41719a00000000
"vout": [
    {
      "value": 0.00000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_RETURN 6f6d6e6900000007800000050101000000001dcd6500",
        "hex": "6a166f6d6e6900000007800000050101000000001dcd6500",
        "type": "nulldata"
      }
    },
    {
      "value": 0.00090000,
      "n": 1,
      "scriptPubKey": {
        "asm": "0 6cd61b832248cca6a64c237d26b3c966e6c684ca2aaf848e0d4e15e11635e425",
        "hex": "00206cd61b832248cca6a64c237d26b3c966e6c684ca2aaf848e0d4e15e11635e425",
        "reqSigs": 1,
        "type": "witness_v0_scripthash",
        "addresses": [
          "bcrt1qdntphqezfrx2dfjvyd7jdv7fvmnvdpx292hcfrsdfc27z934usjs89azpk"
        ]
      }
    },
    {
      "value": 0.99891668,
      "n": 2,
      "scriptPubKey": {
        "asm": "0 dd0a40bbe3d4e3f86b74dcafc88e3689d72f0522",
        "hex": "0014dd0a40bbe3d4e3f86b74dcafc88e3689d72f0522",
        "reqSigs": 1,
        "type": "witness_v0_keyhash",
        "addresses": [
          "bcrt1qm59ypwlr6n3ls6m5mjhu3r3k38tj7pfzrccpzx"
        ]
      }
    }
  ]

maybe "vout[1].scriptPubKey.type" err

below is the correct example:

omnicore-cli decoderawtransaction 0200000000010100181e7e8a8b71e65d51dc7ba37d30ccaa89226b0b1dd9ec307b1425a2de9f9f0000000017160014b8c37f675894b8c03fcdc75f835809aed6f85ff2feffffff030000000000000000186a166f6d6e6900000007800000050101000000003e95ba801c0200000000000017a91400a2cff336aa494d02eabeedf376ed996437dd55871def052a0100000017a914af315aea20d0ee63a920ac1a67e592e85d945f1c870247304402204408c6767035d4b63798d674758838e5bb161517b2e91bfb941fa3cdd4f53aeb022058de7afb63d887495e48ab25fed7c9a4e4da8031451d82559a2afdde56bf12da012103d94eec02f96f40222a12f9f804ab7cda583146459b360abbd37a06538eb0c6e68a000000
{
  "txid": "83e52efe681aeea35a48e452c42e9fe61293c6865f967d97988f1028e4ca3117",
  "hash": "5e53f8e9a1d8cb359e3962e29fc25568f5938a93d6dfbbdeb72eb48ce3278bd0",
  "version": 2,
  "size": 280,
  "vsize": 199,
  "weight": 793,
  "locktime": 138,
  "vin": [
    {
      "txid": "9f9fdea225147b30ecd91d0b6b2289aacc307da37bdc515de6718b8a7e1e1800",
      "vout": 0,
      "scriptSig": {
        "asm": "0014b8c37f675894b8c03fcdc75f835809aed6f85ff2",
        "hex": "160014b8c37f675894b8c03fcdc75f835809aed6f85ff2"
      },
      "txinwitness": [
        "304402204408c6767035d4b63798d674758838e5bb161517b2e91bfb941fa3cdd4f53aeb022058de7afb63d887495e48ab25fed7c9a4e4da8031451d82559a2afdde56bf12da01",
        "03d94eec02f96f40222a12f9f804ab7cda583146459b360abbd37a06538eb0c6e6"
      ],
      "sequence": 4294967294
    }
  ],
  "vout": [
    {
      "value": 0.00000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_RETURN 6f6d6e6900000007800000050101000000003e95ba80",
        "hex": "6a166f6d6e6900000007800000050101000000003e95ba80",
        "type": "nulldata"
      }
    },
    {
      "value": 0.00000540,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_HASH160 00a2cff336aa494d02eabeedf376ed996437dd55 OP_EQUAL",
        "hex": "a91400a2cff336aa494d02eabeedf376ed996437dd5587",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "2MsJb2gTs5FRVBsBFBz1xejGRUtqVFzDZ77"
        ]
      }
    },
    {
      "value": 49.99999261,
      "n": 2,
      "scriptPubKey": {
        "asm": "OP_HASH160 af315aea20d0ee63a920ac1a67e592e85d945f1c OP_EQUAL",
        "hex": "a914af315aea20d0ee63a920ac1a67e592e85d945f1c87",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "2N9DZN7HX532Wbm8YqLz28RrMbETjM2aXFL"
        ]
      }
    }
  ]
}

@neocarmack
Copy link
Member

neocarmack commented Jun 2, 2022

The two addresses "2MsJb2gTs5FRVBsBFBz1xejGRUtqVFzDZ77" and "2N9DZ N7HX532Wbm8YqLz28RrMbETjM2aXFL" are generated by omnicore, not the btcwallet that is used in lndWallet.

2N9DZN7HX532Wbm8YqLz28RrMbETjM2aXFL is omnicored wallet addres,gen with command "omnicore-cli -regtest getnewaddress" , it's format may be "p2sh-segwit" https://developer.bitcoin.org/reference/rpc/getnewaddress.html

2N9DZ 2MsJb2gTs5FRVBsBFBz1xejGRUtqVFzDZ77 is lnd's address. gen with command "ln-cli newaddress -p2wkh"

@wxf4150
Copy link
Collaborator Author

wxf4150 commented Jun 13, 2022

the relative commond or config to build the test environment :

omnicored-node (map to bitcoind)

cat .bitcoin/bitcoin.conf

#debug=1
server=1
txindex=1
#testnet=1
regtest=1
daemon=1
# cheng's
rpcallowip=113.201.131.212
# guojun's
rpcallowip=183.221.141.247
# Reza's
rpcallowip=172.94.100.14
# test.port=18433
regtest.rpcport=18332
regtest.rpcbind=0.0.0.0
rpcuser=omniwallet
rpcpassword=cB3]iL2@eZ1?cB2?
#rpcbind=
zmqpubrawblock=tcp://0.0.0.0:28332
zmqpubrawtx=tcp://0.0.0.0:28333
rpcallowip=127.0.0.1
rpcallowip=62.234.169.68
# third server
rpcallowip=62.234.188.160
# uprets demo
rpcallowip=124.156.137.79
# huaMao ip 
rpcallowip=59.108.42.114
rpcallowip=106.120.15.66
rpcallowip=115.171.254.63
rpcallowip=0.0.0.0/0
txconfirmtarget=3
estimatefee=6
fallbackfee=0.00001

omnicore-cli (map to bitcoin-cli)

create asset:

omnicore-cli omni_sendissuancefixed "2N9DZN7HX532Wbm8YqLz28RrMbETjM2aXFL" 2 2 0 "t1" "" "ftoken" "baidu.com" "" 10000000000
omnicore-cli omni_listproperties

charge:

omnicore-cli sendtoaddress $walletAddre 1
omnicore-cli "omni_send" 2N9DZN7HX532Wbm8YqLz28RrMbETjM2aXFL "$walletAddre" 2147483653 100
omnicore-cli omni_getbalance $walletAddre 2147483653

omnicore-cli's doc: https://github.com/OmniLayer/omnicore/blob/master/src/omnicore/doc/rpc-api.md

mine:

	omnicore-cli generatetoaddress 3  2N9DZN7HX532Wbm8YqLz28RrMbETjM2aXFL

obd-ln-server (map to lnd):

exec ./lnd-debug
--maxpendingchannels=100
--noseedbackup
"--lnddir=~/apps/oblnd"
"--$CHAIN.active"
"--$CHAIN.$NETWORK"
"--$CHAIN.node"="$BACKEND"
"--$BACKEND.rpchost"="43.138.107.248:18332"
"--$BACKEND.rpcuser"="$RPCUSER"
"--$BACKEND.rpcpass"="$RPCPASS"
"--rpclisten=$HOSTNAME:10010"
"--rpclisten=localhost:10010"
--listen=9736
"--restlisten=0.0.0.0:18080"
--debuglevel="$DEBUG"
--bitcoind.zmqpubrawblock=tcp://43.138.107.248:28332
--bitcoind.zmqpubrawtx=tcp://43.138.107.248:28333
"$@"

you should custom your env your-self: listen_port/RPCUSER/RPCPASS

obd-ln-cli: (map to ln-cli):

lnd-cli getinfo
lnd-cli newaddress np2wkh
lnd-cli connect 02b4c20d120cb326f42887007548f1628ef03df5a16d0c1a9189ba546fb888c520@localhost:9736
lnd-cli openchannel --asset_id 137 --node_key 03f3fbd0438d39f07157977b31a10e4fd9d63ca3d960f2c7c88ac1424181765940 --local_btc_amt=90000 --local_asset_amt=90

@wxf4150
Copy link
Collaborator Author

wxf4150 commented Jun 15, 2022

i have replace p2wsh to p2sh or p2pkh at 7728a9a.
tested function: "ln-cli openchannel".

now the fundingtx:

{
 "txid": "b415f3e3504ca13e97a9687a6846f68639cd15e3544de7b13abcff33d587fffb",
 "hash": "b415f3e3504ca13e97a9687a6846f68639cd15e3544de7b13abcff33d587fffb",
 "version": 2,
 "size": 257,
 "vsize": 257,
 "weight": 1028,
 "locktime": 0,
 "vin": [
   {
     "txid": "c73ccd95e9074fbcea49ee2b0f0e96948cf4d71ff23544cc50619ca8fb34ee09",
     "vout": 2,
     "scriptSig": {
       "asm": "3045022100bd2e9a2fbc5be4893f10bdb251164d54e2f852a64c475f824c2bc6c4a3bc448f022034f052dacc4a57cb65f721c9d8b052485fc7f6571a5e36cea63941791661fd07[ALL] 0291c1d99fc5b35d0720b01383fc11ac788e387d6d5426abaf17ec330850401c46",
       "hex": "483045022100bd2e9a2fbc5be4893f10bdb251164d54e2f852a64c475f824c2bc6c4a3bc448f022034f052dacc4a57cb65f721c9d8b052485fc7f6571a5e36cea63941791661fd0701210291c1d99fc5b35d0720b01383fc11ac788e387d6d5426abaf17ec330850401c46"
     },
     "sequence": 0
   }
 ],
 "vout": [
   {
     "value": 0.00000000,
     "n": 0,
     "scriptPubKey": {
       "asm": "OP_RETURN 6f6d6e6900000007800000050101000000002faf0800",
       "hex": "6a166f6d6e6900000007800000050101000000002faf0800",
       "type": "nulldata"
     }
   },
   {
     "value": 0.00020000,
     "n": 1,
     "scriptPubKey": {
       "asm": "OP_HASH160 33ff3a4a6461ef6a14e6601d65091a9cf8e3cb42 OP_EQUAL",
       "hex": "a91433ff3a4a6461ef6a14e6601d65091a9cf8e3cb4287",
       "reqSigs": 1,
       "type": "scripthash",
       "addresses": [
         "2MwzACbg2aSCKYzEkaaT98MkWFWK3wfjvkK"
       ]
     }
   },
   {
     "value": 0.99927596,
     "n": 2,
     "scriptPubKey": {
       "asm": "OP_DUP OP_HASH160 63a334344b3a47844491a6550ba4671bf129ba3b OP_EQUALVERIFY OP_CHECKSIG",
       "hex": "76a91463a334344b3a47844491a6550ba4671bf129ba3b88ac",
       "reqSigs": 1,
       "type": "pubkeyhash",
       "addresses": [
         "mpbnheoap2HyokSaAjzgS7Z7iS8vZv8DnA"
       ]
     }
   }
 ]
}

mpbnheoap2HyokSaAjzgS7Z7iS8vZv8DnA is ln-wallet's address gen with command "ln-cli newaddress", now its p2pkh format.
2MwzACbg2aSCKYzEkaaT98MkWFWK3wfjvkK is fundingTx's multisign-address

omnicore.log

2022-06-15T07:29:41Z 	------------------------------
2022-06-15T07:29:41Z 	         version: 0, class C
2022-06-15T07:29:41Z 	            type: 7 (Send To Many)
2022-06-15T07:29:41Z 	        property: 2147483653 (Test token: 5 : 0x80000005)
2022-06-15T07:29:41Z 	       receivers: 1
2022-06-15T07:29:41Z 	               output: 1
2022-06-15T07:29:41Z 	               value: 8.00000000
2022-06-15T07:29:41Z update_tally_map(mpbnheoap2HyokSaAjzgS7Z7iS8vZv8DnA, 2147483653=0x80000005, -800000000, ttype=0): before=19200000000, after=18400000000
2022-06-15T07:29:41Z update_tally_map(2MwzACbg2aSCKYzEkaaT98MkWFWK3wfjvkK, 2147483653=0x80000005, +800000000, ttype=0): before=0, after=800000000
2022-06-15T07:29:41Z recordTX(b415f3e3504ca13e97a9687a6846f68639cd15e3544de7b13abcff33d587fffb, valid=YES, block= 173, type= 7, value= 800000000)

@wxf4150
Copy link
Collaborator Author

wxf4150 commented Jun 15, 2022

new bug
the opened channel commit_fee is -660.

{
            "active": true,
            "remote_pubkey": "03202f05bde97faf6675dda34f9e43932e3a56d7a54c12f8dd02b8ffcf40bddc7a",
            "channel_point": "b415f3e3504ca13e97a9687a6846f68639cd15e3544de7b13abcff33d587fffb:1",
            "chan_id": "190215511670785",
            "btc_capacity": "20000",
            "asset_capacity": "800000000",
            "local_balance": "16530",
            "remote_balance": "0",
            "local_asset_balance": "800000000",
            "remote_asset_balance": "0",
            "asset_id": 2147483653,
            "commit_fee": "-660",
            "commit_weight": "1108",
            "fee_per_kw": "2500",
            "unsettled_balance": "0",
            "total_satoshis_sent": "0",
            "total_satoshis_received": "0",
            "num_updates": "0",
            "pending_htlcs": [
            ],
            "csv_delay": 2016,
            "private": false,
            "initiator": true,
            "chan_status_flags": "ChanStatusDefault",
            "local_chan_reserve_sat": "8000000",
            "remote_chan_reserve_sat": "8000000",
            "static_remote_key": false,
            "commitment_type": "ANCHORS",
            "lifetime": "43",
            "uptime": "43",
            "close_address": "",
            "push_btc_amount_sat": "0",
            "push_asset_amount_sat": "0",
            "thaw_height": 0,
            "local_constraints": {
                "csv_delay": 2016,
                "chan_reserve_sat": "8000000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "792000000",
                "min_htlc_msat": "10",
                "max_accepted_htlcs": 483
            },
            "remote_constraints": {
                "csv_delay": 2016,
                "chan_reserve_sat": "8000000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "792000000",
                "min_htlc_msat": "10",
                "max_accepted_htlcs": 483
            }
        }

@wxf4150
Copy link
Collaborator Author

wxf4150 commented Jun 16, 2022

we use p2sh ,without witeness. the tx size int input/size.go, may be affected.

lnd/input/size.go

Lines 184 to 223 in 6e2214f

// BaseCommitmentTxSize 125 + 43 * num-htlc-outputs bytes
// - Version: 4 bytes
// - WitnessHeader <---- part of the witness data
// - CountTxIn: 1 byte
// - TxIn: 41 bytes
// FundingInput
// - CountTxOut: 1 byte
// - TxOut: 74 + 43 * num-htlc-outputs bytes
// OutputPayingToThem,
// OutputPayingToUs,
// ....HTLCOutputs...
// - LockTime: 4 bytes
BaseCommitmentTxSize = 4 + 1 + FundingInputSize + 1 +
CommitmentDelayOutput + CommitmentKeyHashOutput + 4
// BaseCommitmentTxWeight 500 weight
BaseCommitmentTxWeight = witnessScaleFactor * BaseCommitmentTxSize
// WitnessCommitmentTxWeight 224 weight
WitnessCommitmentTxWeight = WitnessHeaderSize + MultiSigWitnessSize
// BaseAnchorCommitmentTxSize 225 + 43 * num-htlc-outputs bytes
// - Version: 4 bytes
// - WitnessHeader <---- part of the witness data
// - CountTxIn: 1 byte
// - TxIn: 41 bytes
// FundingInput
// - CountTxOut: 3 byte
// - TxOut: 4*43 + 43 * num-htlc-outputs bytes
// OutputPayingToThem,
// OutputPayingToUs,
// AnchorPayingToThem,
// AnchorPayingToUs,
// ....HTLCOutputs...
// - LockTime: 4 bytes
BaseAnchorCommitmentTxSize = 4 + 1 + FundingInputSize + 3 +
2*CommitmentDelayOutput + 2*CommitmentAnchorOutput + 4
// BaseAnchorCommitmentTxWeight 900 weight.
BaseAnchorCommitmentTxWeight = witnessScaleFactor * BaseAnchorCommitmentTxSize

@wxf4150
Copy link
Collaborator Author

wxf4150 commented Jun 16, 2022

new bug che channelInfo.capacity should be 800000000 for asset ,not btc.

lncli getchaninfo 190215511670785
{
    "channel_id": "190215511670785",
    "chan_point": "b415f3e3504ca13e97a9687a6846f68639cd15e3544de7b13abcff33d587fffb:1",
    "last_update": 0,
    "node1_pub": "03202f05bde97faf6675dda34f9e43932e3a56d7a54c12f8dd02b8ffcf40bddc7a",
    "node2_pub": "0328031e59d805f01459699665cf7bfc89af624eeee9f16ded9d78aebf5caeec3c",
    "capacity": "20000",
    "node1_policy": null,
    "node2_policy": null
}

@wxf4150
Copy link
Collaborator Author

wxf4150 commented Jun 16, 2022

new bug che channelInfo.capacity should be 800000000 for asset ,not btc.
fix at commit 429cbe4

when channel active, the announcement msg process err, the cap should not load from utxo,should use the cap field in the msg

@wxf4150
Copy link
Collaborator Author

wxf4150 commented Jun 20, 2022

new bug:

lncli addinvoice --asset_id 2147483653 --amt_msat 100000000
error msg:
[lncli] rpc error: code = Unknown desc = tlv stream is not canonical

@wxf4150
Copy link
Collaborator Author

wxf4150 commented Jun 20, 2022

[lncli] rpc error: code = Unknown desc = tlv stream is not canonical

fix at commit 8db9f62

it's ok now:

lncli addinvoice --asset_id 2147483653 --amt_msat 100000000
{
    "r_hash": "cce44ef69238789aaef6282633be9e4cfbb6b96ceb391d8089aed944c99424b2",
    "payment_request": "obort1m1p3tqsr5pp5enjyaa5j8puf4thk9qnr8057fnamdwtvavu3mqyf4mv5fjv5yjeqdqqcqzpgxqyz5vqsp5028c04a8wle0mme45vnsg7mdlg8463265ud5xq6jx220ekmh6z0s9qyyssq2ujp657prjw2emafdghnn9pgng0t2j48dv7g79e9xvef8uceh8s5g4x2d0yg5juquvv3ujxrs2fdvlwj36aj3hfxen49scf9c0gej4cqnskqjz",
    "add_index": "1",
    "payment_addr": "7a8f87d7a777f2fdef35a327047b6dfa0f5d455aa71b4303523294fcdb77d09f"
}

@wxf4150
Copy link
Collaborator Author

wxf4150 commented Jun 20, 2022

new bug:
lncli decodepayreq obort1m1p3tqsr5pp5enjyaa5j8puf4thk9qnr8057fnamdwtvavu3mqyf4mv5fjv5yjeqdqqcqzpgxqyz5vqsp5028c04a8wle0mme45vnsg7mdlg8463265ud5xq6jx220ekmh6z0s9qyyssq2ujp657prjw2emafdghnn9pgng0t2j48dv7g79e9xvef8uceh8s5g4x2d0yg5juquvv3ujxrs2fdvlwj36aj3hfxen49scf9c0gej4cqnskqjz

return :
[lncli] rpc error: code = Unavailable desc = error reading from server: EOF

server log:

panic: runtime error: index out of range [1] with length 1

goroutine 885 [running]:
github.com/lightningnetwork/lnd/zpay32.Decode({0xc0003a45a0, 0x101}, 0x2909ca0)
        lnd/zpay32/decode.go:95 +0x15e5
github.com/lightningnetwork/lnd.(*rpcServer).DecodePayReq(0xc0000ea2d0, {0x1f0ec60, 0xc000b80870}, 0xc00229e3c0)
       lnd/rpcserver.go:6280 +0x193
github.com/lightningnetwork/lnd/lnrpc._Lightning_DecodePayReq_Handler.func1({0x1f0ec60, 0xc000b80870}, {0x1b3b820, 0xc00229e3c0})
        lnd/lnrpc/lightning_grpc.pb.go:2623 +0xfa
github.com/lightningnetwork/lnd/rpcperms.(*InterceptorChain).middlewareUnaryServerInterceptor.func1({0x1f0ec60, 0xc000b80870}, {0x1b3b820, 0xc00229e3c0}, 0xc0003e49e0, 0xc0024d0390)
       lnd/rpcperms/interceptor.go:790 +0x502
......

@wxf4150
Copy link
Collaborator Author

wxf4150 commented Jun 20, 2022

fix err:

> lncli decodepayreq obort1m1p3tqsr5pp5enjyaa5j8puf4thk9qnr8057fnamdwtvavu3mqyf4mv5fjv5yjeqdqqcqzpgxqyz5vqsp5028c04a8wle0mme45vnsg7mdlg8463265ud5xq6jx220ekmh6z0s9qyyssq2ujp657prjw2emafdghnn9pgng0t2j48dv7g79e9xvef8uceh8s5g4x2d0yg5juquvv3ujxrs2fdvlwj36aj3hfxen49scf9c0gej4cqnskqjz
> [lncli] rpc error: code = Unavailable desc = error reading from server: EOF

because the invoice-encode miss assetid; assetid should split by ":" with amt
when encode the invoice, assetid is lost at cli process

the bug fix at commit 0332f69

it's ok now:

ln-cli  addinvoice --asset_id 2147483653 --amt_msat 100000000
{
    "r_hash": "403cecce0648295ccdb4666a4135eea6a91fbd8d60d6d3c3c19895f8ce7a39ab",
    "payment_request": "obort2147483653:11p3tqn9rpp5gq7wensxfq54end5ve4yzd0w5653l0vdvrtd8s7pnz2l3nn68x4sdqqcqzpgxqyz5vq3q8zqqqqq9sp5p2xje5f6rky8wvvty8wvh0lafv7qsl2qkn2x5ng3lg5d2smys2aq9qyyssqhqmmzmjk8ycrhtl2nrya6484j9ne3eaydummvrmqtvca9mf87ads2w5fdchz8ux9s0jhln4wgh32hv7k6h9hvlcyyrw7367h65lycjqp7pwafj",
    "add_index": "3",
    "payment_addr": "0a8d2cd13a1d8877318b21dccbbffd4b3c087d40b4d46a4d11fa28d5436482ba"
}
ln-cli  decodepayreq obort2147483653:11p3tqn9rpp5gq7wensxfq54end5ve4yzd0w5653l0vdvrtd8s7pnz2l3nn68x4sdqqcqzpgxqyz5vq3q8zqqqqq9sp5p2xje5f6rky8wvvty8wvh0lafv7qsl2qkn2x5ng3lg5d2smys2aq9qyyssqhqmmzmjk8ycrhtl2nrya6484j9ne3eaydummvrmqtvca9mf87ads2w5fdchz8ux9s0jhln4wgh32hv7k6h9hvlcyyrw7367h65lycjqp7pwafj
{
    "destination": "0328031e59d805f01459699665cf7bfc89af624eeee9f16ded9d78aebf5caeec3c",
    "payment_hash": "403cecce0648295ccdb4666a4135eea6a91fbd8d60d6d3c3c19895f8ce7a39ab",
    "timestamp": "1655721123",
    "expiry": "86400",
    "description": "",
    "description_hash": "",
    "fallback_addr": "",
    "cltv_expiry": "40",
    "route_hints": [
    ],
    "payment_addr": "0a8d2cd13a1d8877318b21dccbbffd4b3c087d40b4d46a4d11fa28d5436482ba",
    "amt_msat": "100000000",
    "asset_id": 2147483653,
    "features": {
        "9": {
            "name": "tlv-onion",
            "is_required": false,
            "is_known": true
        },
        "14": {
            "name": "payment-addr",
            "is_required": true,
            "is_known": true
        },
        "17": {
            "name": "multi-path-payments",
            "is_required": false,
            "is_known": true
        }
    }
}

@wxf4150 wxf4150 closed this as completed Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@wxf4150 @neocarmack and others