问题描述
我实际上是在 nodejs 中玩区块链(使用 WebStorm IDE)。 以下代码在 Win7 上产生了“BAD_POOL_CALLER”蓝屏。你知道为什么吗?谢谢。
# upgrade PyTorch to the nightly release (change it accordingly)
python -m pip install --pre torch torchvision torchaudio -f https://download.pytorch.org/whl/nightly/cu102/torch_nightly.html
git clone https://github.com/pytorch/pytorch
cd pytorch/docs/
make latexpdf
解决方法
我认为使用 setTimeout 函数改进了处理......不确定但现在似乎工作得更好一些。这远非完美,因为我面临另一个问题,但似乎我走在正确的道路上:
// Parcourir tous les blocs entre bloc courant et bloc-1000 et lister
// toutes les transactions de chaque bloc,avec temporisation de 5
// secondes entre chaque bloc.
let index = 0
web3.eth.getBlockNumber().then(blockNumber => {
for (let i = blockNumber - 1000; i <= blockNumber; i++) {
setTimeout(function(index) {
getBlockInfo(i).then()
console.log('next')
console.log("index=" + index)
},5000 * index,index)
index = index+1
}
});
async function getBlockInfo(i) {
await web3.eth.getBlock(i).then(block => {
block.transactions.forEach(function (t) {
web3.eth.getTransaction(t).then(transaction => {
console.log(i + ' ' + transaction.hash + ' ' + transaction.from + ' ' + transaction.to)
}).catch((error) => {
console.log('erreur')
})
})
}).catch((error) => {console.log(error)})
}