Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ckb-light-wasm-demo
1 change: 1 addition & 0 deletions service/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class LightClient {
async start(): Promise<boolean> {
if (checkLightClientWasm()){
await request(1,this.url,"start",[])
await sleep(5*1000)
return true
}
await sh("cd " + this.dirPath + "/target/release && RUST_LOG=info,ckb_light_client=trace ./ckb-light-client run --config-file ./config.toml > node.log 2>&1 &")
Expand Down
22 changes: 12 additions & 10 deletions test/get_transactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ describe('get_transactions', function () {

console.log("lightTxs.objects.length:", lightTxs.objects.length)
console.log("ckbTxs.objects.length:", ckbTxs.objects.length)
expect(lightTxs.objects.length == ckbTxs.objects.length, "light txs length not equal ckb txs length")
expect(lightTxs.objects.length ).to.be.equal( ckbTxs.objects.length, "light txs length not equal ckb txs length")
for (let i = 0; i < lightTxs.objects.length; i++) {
let lightTx = lightTxs.objects[i]
let ckbTx = ckbTxs.objects[i]
// console.log("lightTx:", lightTx)
// console.log("ckbTx:", ckbTx)
expect(lightTx.transaction.hash == ckbTx.txHash, "light tx hash not equal ckb tx hash")
expect(lightTx.blockNumber == ckbTx.blockNumber, "light block number not equal ckb tx hash")
expect(lightTx.ioIndex == ckbTx.ioIndex, "light block number not equal ckb tx hash")
expect(lightTx.txIndex == ckbTx.txIndex, "light block number not equal ckb tx hash")
expect(lightTx.transaction.hash).to.be.equal(ckbTx.txHash, "light tx hash not equal ckb tx hash")
expect(lightTx.blockNumber ).to.be.equal( ckbTx.blockNumber, "light block number not equal ckb tx hash")
expect(lightTx.ioIndex ).to.be.equal( ckbTx.ioIndex, "light block number not equal ckb tx hash")
expect(lightTx.txIndex ).to.be.equal( ckbTx.txIndex, "light block number not equal ckb tx hash")
}
lightAfterCursor = lightTxs.lastCursor
ckbAfterCursor = ckbTxs.lastCursor
Expand Down Expand Up @@ -109,14 +109,16 @@ describe('get_transactions', function () {

console.log("lightTxs.objects.length:", lightTxs.objects.length)
console.log("ckbTxs.objects.length:", ckbTxs.objects.length)
expect(lightTxs.objects.length == ckbTxs.objects.length, "light txs length not equal ckb txs length")
expect(lightTxs.objects.length ).to.be.equal( ckbTxs.objects.length, "light txs length not equal ckb txs length")
for (let i = 0; i < lightTxs.objects.length; i++) {
let lightTx = lightTxs.objects[i]
let ckbTx = ckbTxs.objects[i]
expect(lightTx.transaction.hash == ckbTx.txHash, "light tx hash not equal ckb tx hash")
expect(lightTx.blockNumber == ckbTx.blockNumber, "light block number not equal ckb tx hash")
expect(lightTx.cells == ckbTx.cells, "light block number not equal ckb tx hash")
expect(lightTx.txIndex == ckbTx.txIndex, "light block number not equal ckb tx hash")
// console.log("index:",i," lightTx:", lightTx.transaction.hash,JSON.stringify(lightTx.cells) )
// console.log("ckbTx:", ckbTx.txHash)
expect(lightTx.transaction.hash ).to.be.equal( ckbTx.txHash, "light tx hash not equal ckb tx hash")
expect(lightTx.blockNumber ).to.be.equal( ckbTx.blockNumber, "light block number not equal ckb tx hash")
expect(JSON.stringify(lightTx.cells) ).to.be.equal( JSON.stringify(ckbTx.cells), "light block number not equal ckb tx hash")
expect(lightTx.txIndex ).to.be.equal( ckbTx.txIndex, "light block number not equal ckb tx hash")
}
lightAfterCursor = lightTxs.lastCursor
ckbAfterCursor = ckbTxs.lastCursor
Expand Down
Loading