Skip to content

Commit

Permalink
Merge pull request #8604 from Agoric/mfig-follow-empty
Browse files Browse the repository at this point in the history
fix(casting): properly follow an unpopulated node
  • Loading branch information
mergify[bot] authored Dec 4, 2023
2 parents 51399d1 + 97be818 commit 8a11dec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions packages/agoric-cli/src/follow.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,12 @@ export default async function followerMain(progname, rawArgs, powers, opts) {
verbose && console.warn('Following', spec);
const castingSpec = makeCastingSpec(spec);
const follower = makeFollower(castingSpec, leader, followerOptions);
for await (const { value, blockHeight, currentBlockHeight } of iterate(
follower,
)) {
for await (const obj of iterate(follower)) {
if ('error' in obj) {
console.error('Error following:', obj.error);
continue;
}
const { value, blockHeight, currentBlockHeight } = obj;
const blockHeightPrefix = opts.blockHeight ? `${blockHeight}:` : '';
const currentBlockHeightPrefix = opts.currentBlockHeight
? `${currentBlockHeight}:`
Expand Down
4 changes: 3 additions & 1 deletion packages/casting/src/follower-cosmjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,11 @@ export const makeCosmjsFollower = (
// contain data.
await null;
for (;;) {
({ value: cursorData, height: cursorBlockHeight } =
let thisHeight;
({ value: cursorData, height: thisHeight } =
await getDataAtHeight(cursorBlockHeight));
if (cursorData.length !== 0) {
cursorBlockHeight = thisHeight;
const cursorStreamCell = streamCellForData(
cursorBlockHeight,
cursorData,
Expand Down

0 comments on commit 8a11dec

Please sign in to comment.