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 and mhofman committed Dec 6, 2023
2 parents 430f524 + 7cebb0f commit 601e960
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 @@ -447,10 +447,12 @@ export const makeCosmjsFollower = (
// If the block has no corresponding data, wait for the first block to
// contain data.
for (;;) {
({ value: cursorData, height: cursorBlockHeight } = await getDataAtHeight(
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 601e960

Please sign in to comment.