Why the need for explicit conversion of Struct element if it is already stored with that type?

If we have the following struct and array: struct Family { bytes32 lastName; uint8 houseNo; uint16 age; } Family[] myFamily; And the following function: function getName(bytes32 name) public view returns (bytes32, uint8, uint16) { for(uint8 i = 0; i < myFamily.length; i++){ if(name == myFamily[i].lastName) { return (myFamily[i].lastName,uint8(myFamily[i].houseNo), myFamily[i].age); } } } Why the need…

Why does declaring returns type bytes memory give a compiler error?

If we have the following code: pragma solidity >= 0.5; contract stringsContract { function takesTwo(string memory str, uint idx) public pure returns (bytes memory) { bytes memory bytesStr = bytes(str); return bytesStr[idx]; } } Why do we get TypeError return argument bytes1 is not explicitly convertible to expected type (type of first return variable bytes…

Is it safe to do multiple payments in between locks (Reentrancy Guard)?

https://diligence.consensys.net/blog/2019/09/stop-using-soliditys-transfer-now/ provides a simple example related to Use a Reentrancy Guard. contract Guarded { … bool locked = false; function withdraw() external { require(!locked, “Reentrant call detected!”); locked = true; … // Multiple Payments locked = false; } } [Q] Is it safe to do mutliple different payments in between the locks? An example will…

Does a trusted blockchain import from BitcoinCore require that chainstate and blocks be from the same source?

Can the chainstate folder from a pruned node be used with the blocks folder from a full node to provide the full blockchain? Assume that both nodes have been running for months. If the blocks folder contains references to filenames in the chainstate folder, then the answer is no. I know this because the filenames…