错误错误:由于部分为空,完全限定的 id 无效 (:-3087871471161192663)

Posted

技术标签:

【中文标题】错误错误:由于部分为空,完全限定的 id 无效 (:-3087871471161192663)【英文标题】:Error Error: fully qualified id is invalid due to empty part (:-3087871471161192663) 【发布时间】:2018-11-26 20:49:58 【问题描述】:

我使用 nem2-sdk 和 javascript,ubuntu16.04。我无法解决这个错误。

lockfunds 交易中,mosaicid 有问题, Error Error: fully qualified id is invalid due to empty part (:-3087871471161192663)

我的程序是,

Alice 制定并宣布锁定资金和聚合交易。

vagrant@ubuntu-xenial:~/mynem$ node agg5report.js
lockFundsTransaction.hash   : DEE9C49BDBD637788BC4CEB8A61EA93121852D8938C438CE3DF9EA1F6F618CE4
lockFundsTransaction.signer : 5D9513282B65A12A1B68DCB67DB64245721F7AE7822BE441FE813173803C512C
lockFundsTransaction.payload: B0000000282D8DC515A47123F11D6699442C514F0783CDAF00CE64C7FF4270B0E30FD7134C5833661E29202E47B8735C1CE6528E750F05A9FF8D9D19F8620C4F492CB9045D9513282B65A12A1B68DCB67DB64245721F7AE7822BE441FE813173803C512C03904C41000000000000000091D0FE411000000029CF5FD941AD25D58096980000000000E001000000000000E20A14968A215AA16479CB8E90EC85802A0C1B2800475D1E3DB4B6D7A16D1ED4
aggregateTransaction.hash   : E20A14968A215AA16479CB8E90EC85802A0C1B2800475D1E3DB4B6D7A16D1ED4
aggregateTransaction.signer : 5D9513282B65A12A1B68DCB67DB64245721F7AE7822BE441FE813173803C512C
aggregateTransaction.payload: 260100000C4F6613C01003D4EAC7E5C4BAE04DE8FEE402C02690EF9F0461FF9FCD0AFBA8F61D3BB427C31D1871881EAB61CD1CA326BAA5FB99C8E95DABB3AD81898DBA015D9513282B65A12A1B68DCB67DB64245721F7AE7822BE441FE813173803C512C02904142000000000000000074D0FE4110000000AA000000550000003390BF02D2BB59C8722297FF998CE89183D0906E469873284C091A5CDC22FD5703905441906C4A59CDF202715BA817088F57D264EA93093632CBDFD0CA0100010029CF5FD941AD25D500E1F50500000000550000005D9513282B65A12A1B68DCB67DB64245721F7AE7822BE441FE813173803C512C0390544190758EB47C28D6143BAA3DE6A8D9C319B503A1BFD8E789E9E20100010029CF5FD941AD25D500E1F50500000000
TransactionAnnounceResponse 
  message: 'packet 9 was pushed to the network via /transaction' 
TransactionAnnounceResponse 
  message: 'packet 500 was pushed to the network via /transaction/partial' 

然后,使用哈希获取 lockfunds 交易信息,发生此错误。

vagrant@ubuntu-xenial:~/mynem$ nem2-cli transaction info -h DEE9C49BDBD637788BC4CEB8A61EA93121852D8938C438CE3DF9EA1F6F618CE4
Error Error: fully qualified id is invalid due to empty part (:-3087871471161192663)
    at throwInvalidFqn (/usr/lib/node_modules/nem2-cli/node_modules/nem2-library/dist/coders/idGenerator.js:38:8)
    at findMosaicSeparatorIndex (/usr/lib/node_modules/nem2-cli/node_modules/nem2-library/dist/coders/idGenerator.js:45:34)
    at Object.generateMosaicId (/usr/lib/node_modules/nem2-cli/node_modules/nem2-library/dist/coders/idGenerator.js:87:30)
    at Object.mosaicId (/usr/lib/node_modules/nem2-cli/node_modules/nem2-library/dist/transactions/NamespaceMosaicId.js:18:32)
    at new MosaicId (/usr/lib/node_modules/nem2-cli/node_modules/nem2-sdk/dist/src/model/mosaic/MosaicId.js:41:50)
    at CreateStandaloneTransactionFromDTO (/usr/lib/node_modules/nem2-cli/node_modules/nem2-sdk/dist/src/infrastructure/transaction/CreateTransactionFromDTO.js:97:249)
    at Object.exports.CreateTransactionFromDTO (/usr/lib/node_modules/nem2-cli/node_modules/nem2-sdk/dist/src/infrastructure/transaction/CreateTransactionFromDTO.js:66:16)
    at MapSubscriber.Observable_1.Observable.fromPromise.map [as project] (/usr/lib/node_modules/nem2-cli/node_modules/nem2-sdk/dist/src/infrastructure/TransactionHttp.js:55:47)
    at MapSubscriber._next (/usr/lib/node_modules/nem2-cli/node_modules/rxjs/operators/map.js:79:35)
    at MapSubscriber.Subscriber.next (/usr/lib/node_modules/nem2-cli/node_modules/rxjs/Subscriber.js:93:18)

rest 没有返回错误,但 "mosaicId":"-3087871471161192663".

vagrant@ubuntu-xenial:~/mynem$ curl http://localhost:3000/transaction/DEE9C49BDBD637788BC4CEB8A61EA93121852D8938C438CE3DF9EA1F6F618CE4
"meta":"height":[183,0],"hash":"DEE9C49BDBD637788BC4CEB8A61EA93121852D8938C438CE3DF9EA1F6F618CE4","merkleComponentHash":"DEE9C49BDBD637788BC4CEB8A61EA93121852D8938C438CE3DF9EA1F6F618CE4","index":0,"id":"5B2716780201710001041857","transaction":"signature":"282D8DC515A47123F11D6699442C514F0783CDAF00CE64C7FF4270B0E30FD7134C5833661E29202E47B8735C1CE6528E750F05A9FF8D9D19F8620C4F492CB904","signer":"5D9513282B65A12A1B68DCB67DB64245721F7AE7822BE441FE813173803C512C","version":36867,"type":16716,"fee":[0,0],"deadline":[1107218577,16],"duration":"480","mosaicId":"-3087871471161192663","amount":"10000000","hash":"4goUloohWqFkecuOkOyFgCoMGygAR10ePbS216FtHtQ="

我认为它通常像"id":[3646934825,3576016193]。 我跟踪了堆栈跟踪,但我找不到问题...

整个代码是,

const nem2Sdk = require("nem2-sdk");

const Address = nem2Sdk.Address,
    Deadline = nem2Sdk.Deadline,
    Account = nem2Sdk.Account,
    UInt64 = nem2Sdk.UInt64,
    NetworkType = nem2Sdk.NetworkType,
    PlainMessage = nem2Sdk.PlainMessage,
    TransferTransaction = nem2Sdk.TransferTransaction,
    Mosaic = nem2Sdk.Mosaic,
    MosaicId = nem2Sdk.MosaicId,
    TransactionHttp = nem2Sdk.TransactionHttp,
    XEM = nem2Sdk.XEM,
    AggregateTransaction = nem2Sdk.AggregateTransaction,
    PublicAccount = nem2Sdk.PublicAccount,
    LockFundsTransaction = nem2Sdk.LockFundsTransaction,
    Listener = nem2Sdk.Listener;


/*
Alice:
  private: 7808B5B53ECF24E40BE17B8EC3D0EB5F7C3F3D938E0D95A415F855AD4C27B2A4
  public: 5D9513282B65A12A1B68DCB67DB64245721F7AE7822BE441FE813173803C512C
  address: SBWEUWON6IBHCW5IC4EI6V6SMTVJGCJWGLF57UGK
Bob:
  private: 31B96EEB0C7FD6F8FB6B4ED09A9EB142A42B194AFBEB9EB52F0B79889F22326E
  public: 3390BF02D2BB59C8722297FF998CE89183D0906E469873284C091A5CDC22FD57
  address: SB2Y5ND4FDLBIO5KHXTKRWODDG2QHIN73DTYT2PC
*/

const alicePrivateKey = '7808B5B53ECF24E40BE17B8EC3D0EB5F7C3F3D938E0D95A415F855AD4C27B2A4';
const bobPublicKey = '3390BF02D2BB59C8722297FF998CE89183D0906E469873284C091A5CDC22FD57';

const aliceAccount = Account.createFromPrivateKey(alicePrivateKey, NetworkType.MIJIN_TEST);
const bobPublicAccount = PublicAccount.createFromPublicKey(bobPublicKey, NetworkType.MIJIN_TEST);

const tx1 = TransferTransaction.create(
    Deadline.create(),
    aliceAccount.address,
    [new Mosaic( new MosaicId('nem:xem'), UInt64.fromUint(100000000))],
    PlainMessage.create(''),
    NetworkType.MIJIN_TEST,
);

const tx2 = TransferTransaction.create(
    Deadline.create(),
    bobPublicAccount.address,
    [new Mosaic( new MosaicId('nem:xem'), UInt64.fromUint(100000000))],
    PlainMessage.create(''),
    NetworkType.MIJIN_TEST,
);

const aggregateTransaction = AggregateTransaction.createBonded(Deadline.create(),
    [
        tx1.toAggregate(bobPublicAccount),
        tx2.toAggregate(aliceAccount.publicAccount),
    ],
    NetworkType.MIJIN_TEST);

//const signedTransaction = aliceAccount.sign(aggregateTransaction);
const signedTransaction = aggregateTransaction.signWith(aliceAccount);


const lockFundsTransaction = LockFundsTransaction.create(
    Deadline.create(),
    XEM.createRelative(10),
    UInt64.fromUint(480),
    signedTransaction,
    NetworkType.MIJIN_TEST);

const lockFundsTransactionSigned = lockFundsTransaction.signWith(aliceAccount);

const transactionHttp = new TransactionHttp('http://localhost:3000');

transactionHttp
    .announce(lockFundsTransactionSigned)
    .subscribe(x => console.log(x), err => console.error(err));

setTimeout(() =>
    transactionHttp
        .announceAggregateBonded(signedTransaction)
        .subscribe(x => console.log(x), err => console.error(err))
,30000);


console.log('lockFundsTransaction.hash   : ' + lockFundsTransactionSigned.hash);
console.log('lockFundsTransaction.signer : ' + lockFundsTransactionSigned.signer);
console.log('lockFundsTransaction.payload: ' + lockFundsTransactionSigned.payload);
console.log('aggregateTransaction.hash   : ' + signedTransaction.hash);
console.log('aggregateTransaction.signer : ' + signedTransaction.signer);
console.log('aggregateTransaction.payload: ' + signedTransaction.payload);

【问题讨论】:

【参考方案1】:

您运行自己的节点吗? 我确实在 mijin 服务器上运行了代码,没有发生错误。

【讨论】:

哦,真的!?是的,我使用 catapult-service-bootstrap 在本地机器上运行自己的节点。

以上是关于错误错误:由于部分为空,完全限定的 id 无效 (:-3087871471161192663)的主要内容,如果未能解决你的问题,请参考以下文章

尝试使用变量名访问表单和子表单时收到无效的限定符错误?

对数据库项目使用完全限定的表名,未解决的引用错误

Visual Studio 2010 - TFS - 无法删除工作区,错误的完全限定用户名

字符串不是空终止错误

提供了我的类型的完全限定名称,但是当我运行程序时,它会在错误的程序集中查找类型

领域错误:无效值,期待 int 并接收:0