Skip to content

Commit b5f0c9f

Browse files
tinyChain --> validateTransfers script updated to support number 1 and number 0.
1 parent cc2523d commit b5f0c9f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/TinyChain/Instance.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,8 +1183,8 @@ class TinyChainInstance {
11831183
typeof to !== 'string' ||
11841184
from.length < 1 ||
11851185
to.length < 1 ||
1186-
!this.#signer.validateAddress(from, 'guess').valid ||
1187-
!this.#signer.validateAddress(to, 'guess').valid
1186+
(from !== '1' && !this.#signer.validateAddress(from, 'guess').valid) ||
1187+
(to !== '0' && !this.#signer.validateAddress(to, 'guess').valid)
11881188
)
11891189
throw new Error('Invalid from/to address!');
11901190

test/TinyChain.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ const tinyWalletSimulation = async () => {
9696
.catch((err) => console.log(red("❌ As expected, Bob can't send from Charlie:"), err.message));
9797

9898
const block4 = createBlock({
99+
gasOptions: { gasLimit: 52000n },
99100
signer: bob,
100101
payload: 'Bob pays back',
101102
transfers: [
@@ -104,6 +105,11 @@ const tinyWalletSimulation = async () => {
104105
to: charlie.getAddress(),
105106
amount: 1000000n,
106107
},
108+
{
109+
from: bob.getAddress(),
110+
to: '0',
111+
amount: 2250n,
112+
},
107113
],
108114
});
109115
await chain.mineBlock(miner.getAddress(), block4);

0 commit comments

Comments
 (0)